Recent Projects

Articles By Category

Basic Linux Commands


Getting Help


Almost all Linux/Unix commands have extra switches (options) that can be used to customize the way a command works. To learn how a command works and the possible options for using the command, type "man <command>" at the Linux shell prompt or search the Internet for "man pages <command>". For example, at the command prompt, you could type "man cd" (don't type the quotes) to learn more about how to use the "cd" command.

Exploring Directories and the File System


 / (a slash)   - represents the top (or root) directory of the file system.
 .. (two periods)   - represents the parent directory (the directory just above the current directory).
 . (a single period)   - represents the current directory.

pwd - Print the name of the current directory.

cd - Change directory.

cd /
- Change to the root/top directory.

cd ..
- Change to the directory one level above the current directory.

ls - List files in current directory.

ls
- Display basic directory listing.

ls -al
- Display directory with hidden files (those that start with a dot) in long format (owner, permission, size, timestamp).

mkdir - Make/create new directory.

mkdir temp
- Creates the directory named "temp" inside the current directory.

rmdir - Removes an empty directory.

rmdir temp
- Removes the directory named "temp" inside the current directory.

rmdir -rf temp
- Removes the directory named "temp" even if it contains files - be careful!

df - Displays the available disk space on each file system.

Working with Files


cp - Copy File.

cp file.txt new_name.txt
- Makes a copy of "file.txt" and names the copy (in the same directory) "new_name.txt".

cp file.txt /home/bob/
- Copies "file.txt" in the current directory and makes a copy and stores it in the /home/bob/ directory.

mv - Move (or Rename) File.

mv file.txt new_name.txt
- Renames the file from "file.txt" to "new_name.txt".

mv file.txt /home/bob/
- Moves "file.txt" in the current directory to the /home/bob/ directory.

rm - Remove (delete) File.

rm file.txt
- Deletes the file named "file.txt".

cat - Displays the contents of a file on standard output (usually the screen unless you direct it [pipe it] somewhere else).

cat file.txt
- Displays the contents of the file named "file.txt".

more - Displays the contents of a file or stream one page at a time. Useful for long files or data. Use space bar to view next page or Enter key to see one line at a time.

more file.txt
- Displays contents of the file from "file.txt".

ls -al|more
- This would display all the files in a directory, one page at a time.

less - Displays the contents of a file like "" except you can page up and down.

less file.txt
- Displays the contents of the file named "file.txt".

chmod - Change the permissions (read, write, execute) of a file.

chmod 775 file.txt
- Gives read, write and execute permissions to User and Group and read and execute to all others.

chmod ug+rwx,o=rx file.txt
- Same as above command, but uses an alternate method of setting permissions.