Nah neh saya ambil dari blog.lxpages.com yang mungkin setidaknya berguna bagi kita-kita yang copoe-copoe dalam linux hehehe trima kasih lxpages ^^ hehehe
1) ls
This basic command is your eyeball into the filesystem. Use it to list the contents of a directory.
A) To view details such as the file permissions, user and group owner, last time file was modified pass the l option as such
ls -l
B) You can search for filenames by using wildcards. To list files that start with the letter f, use
ls -l f*
2) find
Where did you save that file? Use the find command to find your files. The find command will search where you want it to 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 f recursively starting from the / root directory use the following
find / -name f*
3) man
What did we mean by the man page? 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. So you can usually type man to view it’s manual page. Great when you’re stuck and don’t know what the command is for or how it’s used. You use it by passing a command line as an option like this
man vi
4) vi
The editor of choice for serious linux users [sorry Emacs fans ;-)]. Use the “man vi” command to read details on this prince of editors. Maybe this is why I love editing and coding in linux, I never have to lift my hands to do anything. Here’s a quick and dirty list of vi commands for you to start using.
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 line
C) DD – type in D twice to cut a line.
D) P – type in P to paste a line.
E) :q! – quit without saving
F) :wq! – save and quit
G) :w! – save
5) cat
How do you view the contents of a file? You can let the “cat” of the bag with the cat command! HA! 😉 Here’s how you can use the command
cat filename.txt
6) more
What if there the file you cat fills more than 1 screen? 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) grep
And what 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.
8) chmod
You have a script that you need to run, and oh no it won’t run? By utilizing the “ls -la” command you learned you can see if the script has execute permissions. If it doesn’t you may give it execute permission by running
chmod +x scriptfile
And of course, you can run the scriptfile if it is a script by running it with a ./ preceding the filename on the shell command line like so
./scriptfile
9) ps
What are you running in the background? How can you tell? By using the “ps” command of course you can view What processes are running under your account.
10) cp, mv, rm
How do you 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