Unix cheat sheet

Excerpt from:
Open Source GIS: A GRASS GIS Approach, First Edition, 2002

Table 2.1. List of important UNIX system commands

Command Important option(s) Impact of the command Impact of the option(s)/remarks
cat file display text file contents
chgrp <group> file change group owner of file or directory
chmod <options> file change permissions for file or directory
chown <owner> file change owner of file or directory
cp source target copy file target may be a new file name or directory
df -k partition display free space on hard drive -k: values in kilobyte, dot for current directory
exit finish terminal session/program e.g. to finish GRASS
file file display file type (mime type) displays, if file is in ASCII or binary format
ftp hostname file transfer via network hostname: Internet address
grep string file search for string in file string should be quoted
gunzip file uncompress file with “.gz” extension
gzip file compress file
head -n file display heading lines of text file -n: number of lines to display
kill -9 pid remove hanging process from system -9: force removal, find pid with ps command
lpr -P printer file print file on printer
ls -l or -la list directory’s contents -l: long, -la: hidden files as well
man program online manual Usage: man program
mkdir directory make directory
more ascii_file display text file page-wise continue with <ENTER> to next page
mv -i source target move or rename file/directory source and target: new filename or directory
ps -aef (or -aux) display running processes display process data, especially pid (process-ID)
pwd print working directory
rm -i file resp. -ir directory remove file/directory -i: query interactively, -r: recursive
rmdir directory remove empty directory
script logfile log session into text file finish with <CTRL><D>
ssh hostname secure terminal for external hosts hostname: Internet address
tar xvf package.tar extract files with directory structure
tar cvf newpack.tar source package directory structure -c silently overwrites existing packages



Unix file permissions


GRASS GIS: possible data organization