Thursday, September 23, 2010

Linux is awesome if you remember the commands??

Recently, my friend had to use Linux to do something. After one day working, he told me a statement and I think it is funny: "Linux is awesome if you can remember all the commands, otherwise, Linux sucks."

Then, I think a little bit. That's may not be true since Linux has many choices of Windows Environments like Gnome, KDE, etc. They are easy to use and very handy. Most daily works, you can do them by a few click just likes M$ Windows.

However, I do agree that the commands in Linux is awesome if you know them. Sometimes, I use "wget" to download files instead of browser. I use vi(vim) as my major text editor. Writing a bash script can do more such as starting some services/programs when the Linux starts.

Here are some commands I think they are useful:

1. Ctrl + E and Ctrl + A
Sometimes, you find that you need to modify the command at the beginning or at the end. You can simply press "Home" or "End" to go the first position or last position. However, it doesn't work such as using SSH. If you really want to go to beginning, the stupid way is to press left arrow. In fact, you can use Ctrl+E to move the end and Ctrl+A to move to the beginning.

2. !$ - A useful variable.
This stores the last argument in the previous command. Here is an example to this variable.
$ mkdir folder
$ cd folder


In fact, you can you use the following commands:
$ mkdir folder
$ cd !$


3. A crazy command, I like this command very much!
$ :(){:|:&};:

It seems that it is an invalid command. In fact, this does work!!
First of all, :(){ ... } defines a function called ":" with no arguments. In side this function, is call ":" again and "|"=pipe the output to itself. The semi-colon end the function definition and the last colon call the function.
To be concluded, this command call a function that recursively creates a process. Then, your system will hang..

No comments:

Post a Comment