Unix 201


On Line Help:

man "command name"
The man command allows the user to get information on the use of a particular command or function.
man -k name
The -k option will list commands related to the given name you want.
e.g. man ls <RETURN> would provide information on the "ls" or list command.
e.g. man -k list<RETURN> would provide a list of a number of commands relating to the word list. Use the -k option when you are not sure of the particular command you want.




The File System:


The List Command.

ls-
The ls command lists the files in your current working directory. e.g. ls <RETURN> would produce a listing of the files in your current working directory.
ls -l
e.g. ls -l <RETURN> would produce a listing of the files in your current working directory as well as showingownership and displaying the read, write, execute, permissions.
ls -lag
e.g. ls -lag <RETURN> would produce a list of all current permissions field, including the group ownership of the file in a long output.

man -ls for all options available.


The Change Directory Command:

cd "directory name"
The cd command changes your current working directory to the one specified in "directory name". Using ".." moves you up one directory in the directory hierarchy. If no directory is specified then cd will move you to your home directory.
e.g. cd/bin <RETURN> would move you to the "/bin" directory.
e.g. cd..<RETURN> would move you to the previous directory, for instance to "/finearts/home" from "/finearts/home/fflinstone".
e.g. cd <RETURN> would move you to your home directory.


The Change File Permissions Command:

chmod ugo+/-rwx
The chmod command will set the file permissions on the specified file. The first character specifies the owner's permissions (u), the second character specifies the group permissions (g), and the third character specifies permissions for all others (o). Using the symbols of either +/- will determine whether you want to give (+) or deny (-) read (r), write (w) and execute (x) access.
e.g. chmod ugo+rwx "filename"<RETURN> would give read, write and execute access to the owner his or her group and others.
e.g. chmod u=rwx "filename"<RETURN>would give read, write and execute access to the owner and deny access to all others.
e.g. chmod go-wx "filename"<RETURN> would deny write and execute access to group and others.
e.g. chmod o+rx "filename"<RETURN>would give read and execute access to everyone. (Popular command for changing file protections on Falcon.)


The Print Working Directory Command.

pwd
The pwd command will print the full name of your current working directory.
e.g.pwd <RETURN> would tell you what directory you were currently working in. For instance"finearts/home".


The Copy Command:

cp "file name 1" "file name 2"
cp "file name" "directory name"
The cp command will copy the contents of "filename 1" into "filename 2" or will copy a file into a specified directory. This command will only work if you have read permission on the file you wish to copy and write permission on the file or directory you wish to copy it into.
e.g. cp report old_report <RETURN> would copy the contents of the file "report" into the file "old_report".
e.g. cp report /finearts/home/userID <RETURN> would copy the file "report" into the directory "/finearts/home/userID".


The Move Command:

mv "file name 1" "file name 2"
mv "file name" "directory name"
The mv command moves a file from one location to another. It can also be used to rename files by moving them to the same place but with a different name. This command will work only if you have both read and write permissions on the file you are moving and write permission on the directory you are moving it to.
e.g. mv old_file new_file <RETURN> would rename "old_file" as "new_file".
e.g. mv myfile /finearts/home/userID<RETURN> would move "myfile" into the directory "/finearts/home/userID".


The Remove File Command:

rm "file name"
The rm command removes the file "filename" from the file system. For this command to work you must have write permission on the file you are removing.
e.g. rm silly_file <RETURN> would remove the file "silly_file".


The Make Directory Command:

mkdir "directory name"
The mkdir command creates an empty directory with the name "directory name". For this command to work, you must first have write permission in the directory in which you are trying to create your new directory.
e.g. mkdir new <RETURN> would create an empty directory with the name "new" in the current working directory.


The Remove Directory Command:

rmdir "directory name"
The rmdir command removes the directory with the specified name from the file system. To remove a directory you must first have write permission on that directory and the directory must be empty.
e.g. rmdir old <RETURN> would remove the directory entitled "old" from the file system.



Viewing the Contents of a File:


The More Command:

more "file name"
The more command will allow you to view the contents of a file. It will display each page of the file on the screen. To move to the next page just hit <SPACEBAR>
e.g. more silly_file <RETURN> would display the contents of the file called"silly_file."



Printing:

The Print Command:

lp "file name" The lp command sends the file specified to the default printer lp stuff <RETURN>would send the file "stuff" to the default printer to be printed.

The Printer Queue Checks:

lpq
lpq -P"printer name"
The lpq command lists the documents waiting to be printed on the printer.

Password Command:

passwd
Type this command and simply follow the instructions to change your password.