Temple College Logo R. Craig Collins > Common > DOS to UNIX

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

DOS

 

UNIX (*Linux)

 
Help commands
help   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 hyphens 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 join commands; 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
auto correct   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 & starts command, but will run in background
       
[Ctrl]+[z] pause    
       
Database features      
find search for files in a directory hierarchy
grep print lines matching a pattern, used to search for words within files
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
   
Other useful info  
nice [command] runs the command as low priority
[command];[command] use the ; to start multiple programs
[command] & start process in background (fg will bring it back to the foreground)
[Ctrl] [z] suspend process
df show free disk space (see man df for other options)
ps show processes (see man ps for other options)
free show remaining RAM
dd convert, then copy a file... used when using Windows to download a Linux distro
tar create a compressed format backup file, ie tar -cvf /home/archive.tar /etc
where archive is the file created in the /home directory, and is a backup of /etc

The Bourne shell replaced the Thompson shell in 1977, becoming the default UNIX shell
C shell uses C language-like syntaxis, and is an interactive shell, mainly used to write programs called shell scripts
The KornShell is a complete, powerful, high-level programming interface for writing applications
The Bash shell, Bourne Again SHell, is an updated version of the Bourne shell, and is now the default shell for Linux