CSE 517 HOME

Frequently used commands in UNIX
 
 

Name of the command UNIX keyword Description Example (% indicates UNIX prompt. You need not type it, it will already be present on your screen)
1. list ls -al This command lists all the files and directories present in the current directory. %ls -al
2. present work directory pwd This command tells you which directory, you are currently working in. It is called present-work-directory command. %pwd
3. change directory cd This command helps you change from one directory to another. Merely typing cd without any argument will take you to your home directory. %cd
4. change directory cd This command when followed by an argument will take you to the directory referred by that argument. %cd  /home/msubram/lab1
5. Copy command cp This command will help you to make another copy of an existing file. %cp  pattern.vhd  backup.vhd
(In this example, we are making a copy of pattern.vhd file. The name of the copy-file is backup.vhd)
6. Move command mv This command will help you to move a file from one name to another. %mv   pattern.vhd  backup.vhd
The file called pattern.vhd will be nmoved to a different name called backup.vhd. The file called pattern.vhd will not exist anymore. Only backup.vhd will exist after the execution of this command.
7. Make a directory mkdir This helps you to create a new directory. %mkdir  lab2
After executing this command, you will find a new directory called lab2 under your present working directory.
8. remove a file rm This command helps you to remove a particular file. %rm  pattern.vhd
After executting this command you will not find the file called pattern.vhd
9. manual command man This command opens the UNIX manual for your reference. %man  mkdir
After typing this command, you will see information on mkdir command, from the UNIX manual pages. You may get information on any command using this man command.

More Examples:

1. How do I copy a file from a particular directory to my present directory ?

Lets assume that your present work directory is /home/c517guru/lab1. You want to copy a file called pattern.vhd from the directory called /home/msubram/lab1 to your present work directory. This is how you do it,

% cp /home/msubram/lab1/pattern.vhd   .
(the dot at the end of the above command indicates that you want to copy pattern.vhd to the present directory)

2. How do I go one directory above my present work directory ?

% cd  ..

3. How do I remove a whole directory ?

% \rm  -rf  lab1
(Note that there is a back-slash in front of the rm command)

4. How I do I copy all the files ending with .vhd from a particular directory to my current working directory ?

% cp  -rf  /home/msubram/*.vhd  .

TOP