Basic Linux
Basic Linux Commands
Command | Action | Example |
---|---|---|
pwd | Print working directory (Show the directory which you reside in) | NA |
ls | List the contents of a directory | NA |
ls -lh | List the contents of a directory and show additional information about the files | NA |
ls -lah | List all files including hidden files | NA |
ls -ltrh | List all files in reverse date order | NA |
ls -lrh | List all files in reverse order | NA |
cd | Change directory | cd /Path/To/Directory |
cd .. | Go to parent directory | NA |
file | Determine the type of a file | file filename |
cat | Display text file on screen | cat filename |
less | View text file | less filename |
cp | Copy a file | cp file1 file2 |
mv | Rename a file | mv file1 newname |
mv | Move file from one location to another | mv file /To/Location/ |
rm | Remove/Delete a file | rm file1 |
rm -r | Remove/Delete a directory with it contents | rm -r directory |
rm -i | Ask before deleting a file or directory (use with -r switch) | rm -ir directory |
rmdir | Delete an empty directory | rmdir directory |
mkdir | Create a directory | mkdir new_directory |
tail -f | View output appended data as the file grows | tail -f filename |
Man Pages
Man pages (short for manual pages) are a form of software documentation, which can be used either from the Linux terminal or on the web, by googling say for example man cp
Man Pages can be especially helpful in determining appropriate switches for commands. See below for examples of use
Example syntax to retrieve information about the cp "copy command"
man cp
would produce a similar representation to the image below. It details all of the associated switches which are possible with the cp command.
The man command can be used with nearly all commands to retrieve additional information about a command.
UEA information
General information
- Ubuntu Desktop Guide
- Surrey UNIX Tutorial for Beginners
- Software Carpentry - lectures on Unix and general computing aimed at scientists