File Commands
ls
-
list directoryls -al
-
formatted listing with hidden filesls -ltr
-
formatted listing ordered by timecd dir
-
change to directorycd -
-
go to directory in previouslycd
-
go to home directorypwd
-
show current directory pathmkdir dir
-
make directory dirrm file
-
delete filerm -r dir
-
delete directory dirrm -f file
-
force remove filerm -rf dir
-
force remove directory dircp file1 file2
-
copy file1 to file2cp -r dir1 dir2
-
copy dir1 to dir2; create dir2 if it doesn’t existmv file1 file2
-
rename/move file1 to file2 if file2 is an existing dir, moves file1ln -s file link
-
create symbolic link link to filetouch file
-
create or update filecat > file
-
places standard input into filemore file
-
output the contents of filehead file
-
output the first 10 lines of filetail file
-
output the last 10 lines of filetail -f file
-
output the contents of file as it grows, starting with the last 10ssh user@host -
connect to host as userssh -p port user@host -
connect to host on port port as userssh-copy-id user@host -
add your key to host for user to enable a keyed or passwordless loginping host –
ping host and output resultswhois domain –
get whois information for domaindig domain –
get DNS information for domaindig -x host
–
reverse lookup hostwget file
–
download filewget -c file
–
continue a stopped downloadSave File in Vi / Vim Text Editor
Command Description
q :Quit
q! :Quit without saving changes i.e. discard changes
r : :fileName Read data from file called fileName
wq :Write and quit (save and exit)
w :fileName Write to file called fileName (save as)
w! :fileName Overwrite to file called fileName (save as forcefully)