Synfire's Quick Guide to Linux

Commands

            List of Commands
            
! ............. repeats commands
alias  ........ this allows the user view the current aliases
cal ........... shows a calendar
cat ........... concatenates and  prints a file
cd ............ changes directories
chmod ......... changes the permission on a file
chown ......... changes the individual ownership of a file
cmp ........... compairs two files
comm .......... compares two sorted files line by line
cp ............ copies file to another location
date .......... returns the date and time
df ............ shows all mounted drives on your machine
diff .......... displays the differences between two files
du ............ shows the disk usage in blocks for a directory
echo .......... echoes the data to the screen or file
env ........... lists the current environment variables / sets an NAME
                to a VALUE in the environment then runs a COMMAND
expr .......... evaluates a mathmatical formula
find .......... finds a file
gcc ........... GNU c compiler
grep .......... searches for a pattern within a file
gawk .......... this allows users to search for patterns within a file
info .......... gives detailed information on any command
kill .......... stops a running process
ln ............ creates a link between two files
lpr ........... copies the file to the line printer
ls ............ lists the files in a directory
mail .......... allows the user to send/receive mail
man ........... displays a brief discription of a particular command
mkbootdisk .... creates a boot disk
mkdir ......... makes directory
more .......... displays a data file to the screen
mv ............ used to move or rename files
nohup ......... allows a command to continue running even when you log out
passwd ........ changes your password
ps ............ Lists the current processes running
pwd ........... displays the name of the working directory
rm ............ removes files
rmdir ......... removes directories
set ........... lists all the variables in the current shell
shutdown ...... restarts or shutsdown you computer
sleep ......... causes a process to become inactive
sort .......... sorts files
split ......... divides a file
stty .......... sets the terminal options
tar ........... Allows access to compress and decompress tarball files
touch ......... creates an empty file or updates the time/date stamp on a file
troff ......... outputs formatted output
tset .......... sets the terminal type
umask ......... specifies a new creation mask
vi ............ a powerful text editor
vipw .......... opens the vi editor as well as password file for editing
wc ............ prints the number of bytes, lines, and words in a file
who ........... displays information on other people online
write ......... send a message to another user



            Command Usage
    (not all commands are explained here, just the most common)
    
cat:    cat [OPTION] [FILE]...
        -A  --show-all (same as -vET)
        -b  --number-nonblank (number nonblank output lines)
        -e  same as -vE
        -E  --show-ends (displays a $ at the end of each line)
        -n  --number (number all output lines)
        -s  --squeeze-blank (never more than one blank line)
        -t  same as -vT
        -T  --show-tabs (displays tab characters as ^I)
        -u  (ignored)
        -v  --show-nonprinting (use ^ and M- notation, except
            for LFD and TAB)



cd: cd [-PL] [dir]
        -P  use physical directory structure
        -L  follow symbolic links
        
chmod:  chmod [OPTION] MODE [,MODE]... [FILE]...
        -c  only report when change is made
        -f  silent output
        -v  output a diagnostic for every file processed
        -R  change files and directories reclusively

        MODE: format for a mode is...
            [ugoa] [[+-=][rwxXstugo]]
        
        the first part [ugoa] controls what users has access to 
        the file: the user that owns it(u), other users in the 
        files group(g), other users NOT in the files group(o),
        all users(a).
        
        the second part starts of with a +, -, or an =. The +
        adds the permission selected to the file, - takes the
        permission selected away from the file, and = sets the
        permission selected as the only permission the file has.

        the second part ends with a permission: read(r), write(w),
        execute(x), execute only if the file is a directory or 
        already has execute permissions for some user(X), set the
        group or user ID on execution(s), save program text on swap
        device(t), the permissions the user who owns the file 
        currently has on it(u), the permissions the other users
        in the file's group has on it(g), and the permissions the
        other users NOT in the file's group has on it(o).
        
        Note: chmod never changes the the permissions of a symbolic
        link, so don't even try! ;)
        
chown:  chown [OPTION] OWNER[:[GROUP]] FILE...
        chown has the same OPTIONS as chmod
        
cmp:    cmp [OPTION]... FILE1 [FILE2]
        -c  --print-characters (outputs differing bytes as
            characters)
        -i X    --ignore-initial=X (ignore first X bytes of input)
        -l  --verbose (outputs offsets and codes of all differing
            bytes)
        -s  --silent (output nothing; yield exit status only)
        
comm:   comm [OPTION]... LEFT_FILE RIGHT_FILE
        -1  suppress lines unique to left file
        -2  suppress lines unique to right file
        -3  suppress lines unique to both files
        
cp: cp [OPTION] SOURCE DEST
        -a  --archive (same as -dpR)
        -b  --back-up (make a backup of each destination file)
        -d  --no-dereference (preserve links)
        -f  --force (remove existing destinations, never prompt)
        -i  --interactive (prompt before overwrite)
        -l  --link (link files instead of copying)
        -p  --preserve (preserve file attributes if possible)
        -P  --parents (append source path to directory)
        -r  copy reclusively, non-directories as files
            WARNING: use -R when copying special files like
            FIFO or /dev/zero.
        -R  copy directories reclusively
        -s  make symlink instead of copying
        -S  --suffix=SUFFIX (overide the usual backup suffix)
        -u  --update (copy only when SOURCE file is newer than
            the DEST file).
        -v  --verbose (explaine what is being done)
        -x  --one-filesystem (stay on this filesystem)
        
date:   date [OPTION] [+FORMAT]
        -d  --date=STRING (display time discribed by STRING)
        -r  --reference=FILE (display last modification date
            of FILE)
        -R  --rfc-822 (output RFC-822 compliant date string)
        -s  --set=STRING (set time described by STRING)
        -u  --utc-universal (print or set Coordinated Universal
            Time)
            
df: df [OPTION] [FILE]
        -h  --human-readable (prints sizes in human readable
            format: 3K, 234M, 3G)
        -i  --inodes (list inodes information instead of block
            usage)
        -k  --kilobytes (same as --block-size=1024)
        -m  --megabytes (same as --block-size=1048576)
        
diff:   diff [OPTION] FILE1 FILE2
        -a  --text (treat all files as text)
        -i  --ignore-case (consider UPPER- and LOWER- case the same)
        -w  --ignore-all-spaces (ignore all whitespaces)
        -b  --ignore-space-change (ignore amount of whitespaces)
        -B  --ignore-blank (ignore changes in blank lines)
        -q  --quiet (output only whether files differ)
        -e  --ed (output an ed script)
        -n  --rcs (output an RCS format diff)
        -y  --side-by-side (output in two columns)
        -s  report when two files are the same
        -k SUF  --backup[=SUF] (compare file(s) with backup(s) ending
            with SUF)
        -x PAT  --exclude=PAT (exclude files that match PAT
        -H  --speed-large-files (assume large files and many 
            scattered changes)
            
du: du -sh [FILE]    (fuck all the other options that is the best)


cho:    echo [OPTION] [STRING]...
        -n  do not output the trailing newline
        -e  enable interpretation of the backslash-escaped
            characters
        -E  disable interpretation of those sequences in STRINGs

env:    env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]... ]
        -i  --ignore-environment    start with an empty environment
        -u  --unset=NAME    remove variable from the environment
        
info:   info [FILE]

kill:   kill [OPTION] pid
        -s SIGNAL   --send (sends the specified signal)
        -p      --print-pid (prints the pid of the named
                processes)
                
ln: ln [OPTION]... TARGET [LINK_NAME]
        -b  --backup[=CONTROL] (make a backup of each existing
            destination file)
        -f  --force (remove existing destination file)
        -i  --interactive (prompt whether to remove destinations)
        -S  --suffix=SUFFIX (override the usual backup suffix)
        -v  --verbose (print the name of each file before linking)
        
ls: ls [OPTION] [FILE...]
        -a  list all
        -A  list all except . and ..
        -f  do not sort
        -h  print sizes in human readable form
        -i  print index number of each file
        -m  list files side by side the width of the screen
            seperated by commas
        -o  use long listing format
        -Q  enclose entry names in double-quotes
        -r  reverse order while sorting
        -R  list subdirectories reclusively
        -s  print size of each file, in blocks
        -S  sort by file size
        -t  sort by modification time
        -U  do not sort, list in directory order
        -X  sort alphabeticaly by extension
    
man:    man COMMAND

mkdir: mkdir [OPTION] DIRECTORY...
        -m  --mode=MODE (set permission mode as in chmod)
        -p  --parents (no error if existing)
        
mv: mv SOURCE DEST

nohup:  nohup COMMAND [ARG...]

passwd: passwd [OPTION] USERNAME
        -l  locks an accounts password (root only)
        --stdin reads the password from the command line
        -u  unlocks an accounts password (root only)
        -d  disables an accounts password (root only)
        -S  displays information about a users password (root only)
        
rm: rm [OPTION] FILE...
        -d  unlink directory, even if non-empty (root only)
        -f  ignore non-existant files, never prompt
        -i  prompt before removal
        -r  remove contents of a directory reclusively
        -v  explain what is being done

rmdir:  rmdir DIR

shutdown:   shutdown [ -r | -h ] now [MESSAGE TO TERMINALS]
            -r  restart
            -h  halt on shutdown

sleep:  sleep NUMBER[SUFFIX]
        NUMBER      how many of the suffix
        SUFFIX      (s) seconds (m) minutes (h) hours (d) days

tar:    tar [OPTION] FILE...
        -t  lists the contents of the archive
        -x  extracts the contents of the archive
        -c  create a new archive
        -d  find differences between archives
        -r  append files to the end of an archive
        -u  append only files newer than copy in archive
        -A  append files to an archive
        
touch:  touch [OPTION] FILE...
        -a  access time only
        -c  do not create any files
        -d  --date=STRING (parse STRING and use it instead of 
            current time)
        -m  change only the modification time
        -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time
        
vi: vi FILE

wc: wc [OPTION] FILE...
        -c  print the byte counts
        -l  print the newline counts
        -L  print the length of the longest line
        -w  print the word count

who:    (when using who it is best to write your own version but if you
         can't just use the following syntax for the best results)
         who -HTu
    
write: write USER [ttyname]

< < < Lesson 1: Installing | Lesson 3: vi & vim > > >