Frequently Used UNIX Commands: Command Function Ls
Frequently Used UNIX Commands: Command Function Ls
Command
Function
ls
pwd
cat
/home/nmora
Catenates files and prints their content on the standard output (display).
cat myfile | more
Lists the content of the file myfile page by page.
cat myfile1 myfile2
List the contents of the files myfile1 and myfile2 one after the other.
cat myfile1 myfile2 > print_record
Creates a file named print_record with the content of the the files myfile1 and
myfile2, i.e., concatenates these two files into one named print_record.
more
cp
cp rung03 /tmp
Copies the file rung03 located in the current directory to /tmp keeping its original
name.
rm
mv
mkdir
Makes directories.
mkdir mydirectory
Creates the directory mydirectory. This command is very useful in organizing the
contents of a directory.
cd
Changes directory.
If the currect directory is /home/nela and mydirectory is a directory of the directory
nela:
cd mydirectory
This will change the currect directory to /home/nela/mydirectory.
rmdir
lpr
Prints files.
lpr myfile
If no printer is specified it will use the printer set by default to print the file myfile.
who
Shows who is logged on the computer and what they are doing.
clear
df
grep
top
kill
ps
chmod
One way of using this command is by using numbers that identify file attributes:
Read: 4; Write: 2; Execute: 1
7 = Read(4) + Write(2) + Execute(1)
6 = Read(4) + Write(2)
5 = Read(4) + Execute(1)
chmod abc <files>
a - permissions for the file's owner
b - permissions for other users belonging to the same group of the owner
c - permissions for anyone else
e.g., chmod 777 myfile
Everyone has permissions to read, write and execute the file
myfile.
e.g., chmod 710 myfile
The owner has all permission access on myfile, and only users in the same group of
the owner can execute myfile, but they cannot read or modify (overwrite) the file.
df
Used to display the amount of disk space being used on the hard drive(s).
df -h
Option -h allows the print out to be in an easily readable format.
passwd
gzip/gunzip
Compresses/uncompresses a file.
gzip myfile
Creates a compressed file: myfile.gz
gunzip myfile
Uncompresses the previous file.
ssh
Program for logging into a remote machine and for executing commands on a remote
machine. It is intended to provide secure encrypted communications between two
untrusted hosts over an insecure network. The user must prove his/her identity to the
remote machine.
ssh p 2200 [email protected]
The user 'nmora' opens a remote secure conection to the host marie.tru.ca.
A password will be prompted.
4
scp
sftp
qstat
Shows the current status of the available Sun Grid Engine queues and the jobs
associated with the queues.
qstat f
Specifies a "full" format display of information. The -f option causes summary
information on all queues to be displayed along with the queued job list.
qdel