Linux Basic Command

Windows Linux using Cygwin

[email protected]:~$ cd /cygdrive/

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

Misc Commands

[email protected]:~$ pwd

[pwd will show the Present working directory]

Directory/File List commands

[email protected]:~$ ls

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

[email protected]:~$ ls b*

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

[email protected]:~$ ls -l

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

[email protected]:~$ ls -a

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

[email protected]:~$ ls -R

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

Read/Write/Transfer/Rename File commands

[email protected]:~$ head -20 <filename>

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

[email protected]:~$ tail -20 <filename>

[ Look at the last 20 lines of a file]

[email protected]:~$ watch tail -n 15 <filename>

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

[email protected]:~$ cat PradeepIT.txt

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

[email protected]:~$ cat > testfile.txt

[ Use to create file]

[email protected]:~$ mv mytext.txt mytext2.txt

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

[email protected]:~$ cat PradeepIT.txt onemore.txt >>new.txt

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

[email protected]:~$ rm PradeepIT.txt

[rm remove the file PradeepIT.txt.]

[email protected]:~$ Vi <filename>

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

[email protected]:~$ Vi <file1> <file2> <file3>

[It will create multiple file at once.]

[email protected]:~$ 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

[email protected]:~$ :q

[to quit (short for :quit)]

[email protected]:~$ :q!

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

[email protected]:~$ :wq

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

[email protected]:~$ :wq!

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

[email protected]:~$ : x

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

[email protected]:~$ :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 *

About Us

Pradeep Academy is an online & Training institute To make learning easy, interesting, affordable and accessible to millions of learners across the Globe.
To create an alternative learning platform, using a unique learning methodology of live online interactive courses along with 24x7 support. We aim to empower our customers with skills which will help them get an edge in their careers and improve their lives.

Contact Us

Address :

#Hosabelaku Building, 3417/13, Near TTMC Bus Stop,, 30 Feet Service Road,

Vijaya Nagar, Bengaluru, Karnataka 560040
Email : [email protected]
Ph No: +91 8660907231
Web: https://academy.pradeepit.com
top
© Pradeep Academy.  Design & Developed by