To Temple College R. Craig Collins > ITSC 1305 > DOS to UNIX

DOS to Command Line UNIX* © R. Craig Collins, 2005/6

DOS

 

UNIX (*Linux)

 
Help commands
help end session w/ Alt+F, X man command end session with q
command /?   whatis command  
    apropos keyword  
Clear screen
cls   clear  
       
To Display the present working directory
prompt $p$g   pwd  
       
Root directory
\   /  
       
Directory Listing Commands
dir detailed ls -l detailed
dir /w just file names ls just file names
tree all directories and files ls -R all directories and files
       
Change Directory/Folder commands
cd basic command cd basic command
cd .. move up one directory cd .. move up one directory
cd \ move to root directory cd / move to root directory
    cd $HOME move to \home\your home
       
Used to make directories/folders
mkdir directoryname   mkdir directoryname  
       
File creation
copy con filename use [Ctrl] + [z] to end touch filename  
    cat filename use [Ctrl] + [d] to end
       
Filename rules
8.3   255 characters allowed  
    avoid spaces and hypens as first character
    'hide' a filename with . for first character ('see' w/ ls -a)
       
Used to specify multiple files
* or ? wildcards * or ? metacharacters
       
Text Editing
edit filename.txt   emacs filename.txt  
       
Display the contents of a text file on the monitor
type filename   cat filename  
       
File Manipulation
move source destination move mv source destination move
rename source destination rename mv source destination rename
copy source destination copy cp source destination copy
  ex copy aa.txt fld/aa.txt   ex cp aa.txt /fld/aa.txt
File deletion
del filename delete rm filename remove
       
Folder deletion      
rd foldername must be empty rmdir foldername must be empty
deltree foldername will delete w/contents rm -rf foldername will delete w/contents
       
File properties
attrib ± ? filename read only, archive, sys, hidden chattr ± ? filename  
       
Folder Properties
    chmod ugo ± ? foldername read, write, execute
      for user, group, or other
    chmod 755 foldername standard web permissions
      d rwx r-x r-x
      read=4
      write=2
      execute=1
      7==4+2+1, r+w+x
To redirect output, such as from the monitor to a file
> ex type aa.txt > lpt1 > ex cat aa.txt > lpt1
       
To take the output of one command and use it as the input for another
| (pipe) ex dir | more | (pipe) ex ls | more
       
Day and Month
date   cal  
    cal mm yyyy  
 

Windows

 

UNIX (*Linux)

 
End Command Line session
exit   exit  
       
Automatically replace typed text with predetermined text
autocorrect   alias xx=command  
       
Searching
search   find filename  
search contains   grep word or phrase  
       
End program
X
     
File\Close   q  
[Ctrl]+[Alt]+[Del]   kill  

UNIX specific items

passwd change password
  (must change at least 3 items)
  required aspects    
  minimum 6 characters minimum of 2 letters minimum of 1 number
  ex Password1    
command ; command start multiple programs by separating commands with semicolon
command & starts command, but will run in background
       
[Ctrl]+[z] pause    
       
Database features      
find search for files in a directory hierarchy
join combine items; create a string by joining list elements
grep print lines matching a pattern
uniq remove duplicate lines from a sorted file
diff find differences between two files
tr translate or delete characters, such as changing from upper case to lower case