Some More Unix

NOTE: Not all UNIX systems are exactly the same, so these commands usually work, but......


* List files in current directory

ls list all files by name only

ls -alsg list all files by name, date, protection, etc.

ls -d */ list all sub-directories only

ll same as ls -alsg on HP-UX systems such as Gaia

* Change Current Directory

cd <directory name> change directory to new <directory name>

cd .. change directory up one level (space between cd and ..)

cd return to home directory (top level)

pwd displays the current directory path

* Help

man <command> you must know the exact name of the command e.g. man ls

* Print file to the main line printer in room ECS 2011

lp -d<queue name> <filename> (Only works on Gaia)

e.g. lp -dtitan_lp memo.txt

This will print the file "memo.txt" to the line printer titan_lp in ECS 2011

* Display contents of a file

more <filename> Print to the screen

e.g. more memo.txt

This will display the file memo.txt on the screen one page at a time

Also, tail -10 memo.txt

Displays the last 10 lines of memo.txt

And, head -10 memo.txt

Displays the first 10 lines of memo.txt

* Delete files

rm <filename> Will delete the file (DOES not give you a second chance!)

e.g. rm

Removes file

And, rm *.gif

Remove all files with extension .gif

And rm *.*

Removes everything in current directory (Be VERY careful with this command)

* Change your password

yppasswd (Reply to each prompt accordingly)

* Diplay users logged-in at this time

w OR who OR rwho

* The pipe (|) command will allow you to combine commands

<command> | <command>

e.g. ls -al | more

This will list a directory one page at a time

* Logout

lo OR logout OR bye

* Change File Permission- This is tricky and will be discussed in lecture when you need the command.

chmod <nnn> <filename> each n= an octal digit where:

0 = none 7 = rwx
6 = rw- 5 = r-x
4 = r--

* Commands that are useful when using FTP

cd <directory_name> Change directory to <directory_name>

ascii For transferring ascii files

binary For transferring binary files

dir Full file directory

ls Short file directory

dir |more List files and directories one page at a time

quit exit ftp

cd .. back up one level in file structure

get <filename> downloads file

get <filename> |more lists contents of files on the screen one page at a time

dir *.txt lists all files that end with .txt

dir README.* lists all files that begin with README.

! temporarily leave the ftp site and return to your local system -- to return to ftp, enter "exit:


Information about files and directory information obtained by
dir, ls or ll

File privileges are:

r for read
w for write
x for execute

For example:

The first column will be:
d for directory
- for text file
l for link to other file

The first rwx indicates the owner privileges

The second rwx indicates the group privileges

The last rwx indicates the other user privileges
(you and me when we are doing anonymous FTP)

Written By: Jay Hennigan

Return to the ECS Home Page