Tuesday, September 16, 2008

Basic LINUX Command for Beginner

1) ls
This basic command Use for to see the list of a directory.
# ls
a) To view details such as the file permissions, user and group owner, last time file was modified
# ls -l
b) Searching filenames by using wildcards. To list files that start with the letter h, use
# ls -l h*


2) find
The find command to find your files. The find command will search and find directories or files that match conditions such as name, date last accessed, file size and more. It has got many abilities, and they’re all listed in the man page.
To search for files starting with the letter h recursively starting from the / root directory use the following
# find / -name h*


3) man
man stands for manual, So “man page” really means it’s manual page. Most linux commands have manual pages that describe how the command is utilized. it just for help user if you forget the use and syntax for any comand. You use it by passing a command line as an option like this
# man vi


4) vi
The editor of choice for linux users.
A) If you notice on your keyboard the letters (H,J,K,L) are adjacent to each other, which makes them ideal keys to use for
navigating this editor.a) l (move right)b) h (move left)c) j (move down)d) k (momve up)B) YY - type in Y twice to copy a lineC) DD - type in D twice to cut a line.D) P - type in P to paste a line.E) :q! - quit without savingF) :wq! - save and quitG) :w! - save


5) cat
To view the contents of a file.
# cat filename.txt


6) more
You can pipe the cat command into more which will allow you to view the contents one screenfull at a time.
# cat filename.txt more


7) cp, mv, rm
For copy, move or remove a file. There’s actually three different commands for each of these functions.
A) copy
# cp oldfilename.txt newfilename.txt
B) move
# mv oldfilename.txt newfilename.txt
C) delete
# rm oldfilename.txt
chmod
This command is used for changing files permission.
# chmod +x filename


9) grep
if you need to search for certain phrases or words in a file? And for this we can use the grep command. Say we want to search for all the occurances of the word “passwd” in a filename, we can use the following command
# grep “passwd” filename.txt
If there are matches, the lines containing “passwd” will be printed.


10) ps
using the “ps” command you can view What processes are running under your account or in background.
# ps


0 comments: