Unix is a open source software that allows the user to manipulate a software enviroment using only command line. Though there are versions out, such as Ubuntu Desktop, that allow the user to interact graphically with the envioment, it is much more prudent to lean the enviorment though the command line if the user wants to become profecent at Unix.

Explanation Output

The ls command

          This command shows you the files of directories at your current level in the file tree. Example right. Notice that the directories are in dark blue, the executable files are in green and the text files are in white. Your screen is going to look different compared to mine, but the concept is the same, shows the files and directories at your current location in the file tree. Here is how the ls command is used in the Unix environment.

ls example

Link for more infomation on: ls command

The cd directory name and pwd commands

          The cd command also known as the change directory command. This command, as the name implies, allows you to change the directory from the current one you are in to one that you specify either through the file path, or using the... option, which allows you to move to the directory directly above your current one. Though there are options to this command at this moment all you need to know is how to move into directories and move to the ones above it. You can also move up multiple directories by using.../.. (this moves you up two directories. A few examples are pictured to the right.

pwd command

This command gives you your location in the file system by giving you the file path from the top of the file tree to where you are. Example right.

cd command:
cd example

pwd command:
cd example

The cat command

          This command is used to print the contents of a file out on the screen without the user actually having to enter the file. Example right. Here are more examples of the cat command along with its command options.

cat example

The more command

          This command, like the cat command, allows the user to view the contents of a file without actually having to open the file itself. This command, unlike cat, allows you to view the first 24 lines of a file at a time, using the space bar to view 24 lines at the time through the file.

more example

The less command

          This command, like the cat command, allows the user to view the contents of a file without actually having to open the file itself. This command, unlike cat, allows you to view one screen of the information at a time.

less example

The nano file/text editor

          This text editor allows the programmer/user to place information inside of files, whether it be PHP, JavaScript, Shell Script, or just plain text. This editor is very easy to use and is simplistic. There is an example of this to the right.

nano example
nano example 2

The mv, cp commands

          The move command allows the user to move (mv) a file from one location to another. The command is set up mv [file name] [file path]. While the copy (cp) command allows the user to copy a file from one location to another. The copy (cp) command is set up in the same way, except that it copies the file and pastes it in another location.

"Move" command:

mv, cp example

"Copy" command:

mv, cp example

The rm command

          This command is set up as such, rm [file name], allows the user to remove a file. This command needs to be used with caution though because it asks for no conformation on whether or not to delete the file. So once you click enter, it is a done deal. That is why it is recommended that you use the -i(interactive) option, which will ask you if you are sure that you want to delete the file. Both instances are pictured right. More examples of the rm command.

rm example

Link for more infomation on: rm command.

The wc command

          This command allows the user to count the number of lines, words, characters, and bytes inside of a file. The information is displayed as such from left to right: the first column is the number of lines, the second column is the number of words in the file and the third column is the number of characters that are in the file, and finally the fifth column is the file path of the file. Here are more examples of the wc command.

wc example

Link for more infomation on: wc command.

Useful Unix commands

          These commands redirect, stream, and text editors allow the user to edit where information goes, whether it is from the command line directly or whether you are manipulating information and placing it into another file. Here is a list of redirects and string manipulators.

useful example

The chmod (change mode) command

          This command allows the user to view and/or change the security options of different files on the system. Here are more examples of the chmod command.

chmod example

Link for more infomation on: chmod Command.

The lpr command

This command allows the user to print text files from the terminal. Though there are other options that can go with this command the main one you need to know is the -P. This command allows the user to specify the printer name. An example of how t use the lpr command are pictured right.

lpr example

The mkdir command

          This command allows the user to make a directory to save files in, this helps in orgaization. The command is set up as such mkdir [optional options] userSelectedDirectoryName There are two main options you will use the -p and the -v option. The -p option creates all directories, that do not exist, up to the last directory. For example, if the user wants to make a directory with a path to it as such: /mywork/homework/assin1 the command will create all the directores exist. So if my work directory does not exist, then it will created on down the line. The -v option (verbose) displays all directories created by the mkdir command. This command option is usually in conjunction with the -p option.

mkdir example

The grep command

          This command allows the user to search files for patterns or key words. This command is set up as such: grep [options] [pattern] Filename There are many options that go along with this command, there are examples on the page.

grep example

Link for more infomation on: grep Command

How to make a Script

          A script allows the user to run commands within a text file. This allows the user to search files as well as dynamically place HTML code into a webpage. It is very easy to make a script, all that the user needs to do is make a text file, add #!/bin/bash to the beginning of the text file, and make the file executable. Then to run the script all the user must do is place a ./ before the the file name, this tells Unix to execute the file.

script example

The sed command

          This command allows the user to manipulate a stream of text, whether it is input from the terminal or from a file. sed has the ability to be used in a pipe (symbole: |), this allows the user to place many sed commands in one large command, or tie sed to another command such as grep. Here are more examples of the sed command.

sed example

Link for more infomation on: sed Command

The diff command

          The diff command compares the contents of two files. This can be very useful when comparing user input or information gathered from client computers on the internet. Here is a comprehensive list of the diff comand's options. The command is set up as such: diff [OPTION] FILE1 FILE2

diff example

The sort command

          sort as the name implies, sorts information from a file. The command gives the user many options such as, sort the data using Alpha (alphabetically), numerically, and a couple other ways. sort is a very useful command and is usually used in conjunction with the uniq command. Here are options and examples of the sort command.

sort example

Link for more infomation on: sort command.

The uniq command

          The uniq command like the diff command compares two text files to eachother. There are differences though that make the uniq command noteworthy as well as useful. The command is set up as such: uniq [option] FILE1 FILE2 Here are the options asscioated with uniq as well as some examples. The uniq is set up as such: uniq [OPTIONS] FILE1 FILE2

uniq example

Link for more infomation on: uniq Command