Setup Menus in Admin Panel

Linux Basic Command

Windows Linux using Cygwin

pradeepit@pradeepit-pc:~$ cd /cygdrive/

[Switch to hard drive drivers example: c d e f]

Misc Commands

pradeepit@pradeepit-pc:~$ pwd

[pwd will show the Present working directory]

Directory/File List commands

pradeepit@pradeepit-pc:~$ ls

[ls will show the list of file and directory of present working directory.]

pradeepit@pradeepit-pc:~$ ls b*

[ls b* will show the list of file and directory starting with b and end with anything.]

pradeepit@pradeepit-pc:~$ ls -l

[Listing of all files and directory along with attributes(i.e. more detailed format like file permission, file size etc.]

pradeepit@pradeepit-pc:~$ ls -a

[Listing of all files and directory along with hidden file or file starting with periods (i.e. file stating with * like *bashrc]

pradeepit@pradeepit-pc:~$ ls -R

[show the listing of file and directory in tree structure.]

Read/Write/Transfer/Rename File commands

pradeepit@pradeepit-pc:~$ head -20 <filename>

[ Look at the 20 lines at beginning of a file]

pradeepit@pradeepit-pc:~$ tail -20 <filename>

[ Look at the last 20 lines of a file]

pradeepit@pradeepit-pc:~$ watch tail -n 15 <filename>

[ Look at the last 20 lines of a growing file (Server log file)]

pradeepit@pradeepit-pc:~$ cat PradeepIT.txt

[User can use the command cat to see the preview of PradeepIT.txt file.]

pradeepit@pradeepit-pc:~$ cat > testfile.txt

[ Use to create file]

pradeepit@pradeepit-pc:~$ mv mytext.txt mytext2.txt

[rename the file mytext.txt to mytext2.txt]

pradeepit@pradeepit-pc:~$ cat PradeepIT.txt onemore.txt >>new.txt

[Transfer the content of PradeepIT.txt and onemore.txt to new.txt file.]

pradeepit@pradeepit-pc:~$ rm PradeepIT.txt

[rm remove the file PradeepIT.txt.]

pradeepit@pradeepit-pc:~$ Vi <filename>

[It will create a Blank file. Note : It will create only if you press Esc keyword followed by :wq!]

pradeepit@pradeepit-pc:~$ Vi <file1> <file2> <file3>

[It will create multiple file at once.]

pradeepit@pradeepit-pc:~$ Vi file1.txt

[to open file1.txt using Vi]

[i- to insert text in file1.txt]

[press Shift+: and then type wq to save and quit.

: q to exit without any changes in file

: x to save changes and exit.]

Commands for Quit Vi EDITOR

pradeepit@pradeepit-pc:~$ :q

[to quit (short for :quit)]

pradeepit@pradeepit-pc:~$ :q!

[Used to quit without saving (short for :quit!)]

pradeepit@pradeepit-pc:~$ :wq

[Used to write and quit (think write and quit)]

pradeepit@pradeepit-pc:~$ :wq!

[Used to write and quit even if file has only read permission (if file does not have write permission: force write)]

pradeepit@pradeepit-pc:~$ : x

[ Used to write and quit (shorter than :wq)]

pradeepit@pradeepit-pc:~$ :qa

[Used to quit all (short for :quitall)]

January 15, 2016

0 responses on "Linux Basic Command"

Leave a Message

Your email address will not be published. Required fields are marked *

© Pradeep Academy.  Design & Developed by