Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

1.

ls

to list files and directories at current location


directories i.e. folders in windows are shown in bluecolor,files are shown in
white color, executable files are show in green color

2. pwd

to print the path of current location

3. cd <dir_name>

to move to <dir_name> from current location

4. mkdir <dir_name>

to create a dir named <dir_name>

5. rm <file_name>

to delete file <file_name>

6. rm -r <dir_name>

delete <dir_name>

7. To create a file
vi <file_name_with_extention>
i) You will see black editor,
Press i to move into insert mode to write text into file, avoid the
use of numkeypad on RHS of your keyboard

:wq to save and close the file


:q to close

8.cat <filename>
to display the contents of the file only

9.gcc <filename_with_extension>
to compile the file, if everything is fine no message appears, it will
cerate a file a.out

10 ./a.out
to run the executable for the program

11. cp <src_file_name> <dst_file_name>

to copy a file ex: cp file1 file2


file2 will be copy of file1

12. mv <old_file_name> <new_file_name>


to rename a file
Ex: mv file1 myfile1
file1 will be renamed as myfile1

13. gcc first.c -o first_output


to make output file other than a.out,
in above ex first_output file will be executable in place of a.out
you can run it ./first_output
14. exit
to logout from unix server

15. Ctrl D
to logout from unix server

You might also like