basic linux vim commands

Upload: mehul-jain

Post on 29-Feb-2016

13 views

Category:

Documents


0 download

DESCRIPTION

Commands for basic linux usage

TRANSCRIPT

To view the current working directory: pwdTo create a new directory: mkdir mkdir IITGTo list files in the directory: lsls IITGTo change/navigate the current working directory: cd cd IITGTo create a new file: touch touch file1.txtTo edit the file: vi file1.txtTo change from command mode to insert mode: press iTo save the contents: press esc and then type :wTo save and exit from the file: press esc and then type :wqTo exit from the file without saving :q!To view the file in terminal without opening it: cat cat file1.txtTo copy files: cp cp file1.txt file2.txtTo rename the file: mv mv file2.txt file3.txtTo delete the file: rm rm file3.txtTo create a deep folder structure: mkdir cs110 cs110/notes cs110/notes/day1To come out from very deep structure to home directory: cd or cd ~cdcd ~To merge multiple file contents into single file using redirection operator: >Cat file1.txt file2.txt > file3.txtHidden files: files with name starting from ..file4List all files in the directory including hidden files: ls a To list all the files in a directory in alphabetical order: ls lTo list all the files in a directory in reverse order (in alphabet): ls lrTo list all the files in a directory according to their modification time: ls -lrt. current directory.. one directory down the current directory structureCreate the following tree structure:

After creating the structure: type tree from home folder in the terminal to verify this. treeGo to directory Fees. Create three more files with extension .doc. Now using single command copy files with extension .txt to directory eee.Cp *.doc ~/IITG/Departments/eee/.Similarly delete those from eee directory. Ensure that your current directory is FeesInside Fees directory, create one more directory Temp. Then copy files with .txt extension. Delete folder temp.To delete the directory containing files: rm r File permissions: Chmod

IITG

Sections

Departments

Academic

Accounts

cse

eee

mech

Regular

Part-time

M_Tech

B_Tech

Ph_D

Fees

B_Tech.txt

M_Tech.txt

Ph_D.txt

Course_structure.txt

courses

cs101

cs110

Lecture.txt

Pgm.txt