Linux Commands

Introduction | Commands | Software | Links

Directory Commands | System Directories | File Commands | Other Commands

Directory Commands

Directory Commands Purpose
cd foldername change the working directory (go to a different folder)
pwd print working directory (displays the path of the current working directory)
mkdir foldername make a new directory (if you have permission to create files in the current directory)
rmdir foldername remove a directory (the directory must be empty)
mount device directory assign a disk drive to a directory so it is useable, e.g. mount /floppy or mount /cdrom
umount directory unmount the floppy drive so the disk can be removed

Contents of Some System Directories

Directory Contents
/ root (contains all other directories in the file system)
/home user's home directories, e.g. /home/umu
/usr standard commands and programs
/tmp temporary files (user and system)
/etc system files (configuration and miscellaneous)
/bin system input/output devices (like printers and terminals)
/dev interfaces for devices (like terminals and printers)
/var files that vary (like mailbox, FTP and web server files)
/mnt mountable volumes (like floppy, hard and CD-ROM drives)

File Commands

File Commands Purpose
ls directory/filenames list file and directory names (specified files in the specified directory, or all in the current directory if you omit directory and filenames)
ls -l filenames

display file details (file type, read, write and execute permissions; owner and group; file size in bytes; date of last modification; and filenames)

cat filenames concatenate (displays contents of text files to the screen, or combines them together)
more filename display text file to the screen, one screen at a time
cp filename1 filename2 copy a file named filename1 to a new file named filename2
mv name1 name2 move or rename a file or directory from name1 to name2 (if name2 is a directory, name1 will be moved)
rm filenames remove (delete) specified files
wc filenames word count (counts characters, words and lines in text files)
sort files > sortedfile sort lines in text files (alphabetically) and save results into sortedfile
spell filename display misspelled words in a text file
grep pattern filenames search files for a pattern (e.g. a text string) and list any matching lines
find directoryname
-name filename -print
find files (full paths of files named filename in directoryname or any subdirectory)
pico filename create or open a text file using the pico editor (other editors you can try include kedit, nedit, emacs and vim)
gzip files filename.gz compress and combine files to produce an archive file named filename.gz (does not delete the original files)
gunzip filename.gz uncompress files in filename.gz (does not delete the archive)

Other Commands

Other Commands Purpose
man command display help information about a command (warning: often very technical)
echo text display text to the screen
clear clear the terminal window
who display users logged onto the system
date display the current date and time
exit quit the shell