Sunday, June 17, 2012

Living in the Command Line

Some people, usually extreme power users, server owners, and hobbyists choose to use the command line as their primary means of communicating with their computer. Richard Stallman has said that he finds that graphics "distract" him. The command line's learning curve is high since you must know about the command you are issuing, and because a lot of applications are now being developed with their front AND backends using GTK or QT. This article will teach you how to block everything else out, and use the command line for daily life.

Tty's are separate logins. You may not know it, but you have 7 open right now if you are using a Linux box. To enter a tty, do this: alt+ctrl+a number 1-6. When you do alt+ctrl+7 from any tty, you will re-enter graphics. Some prefer to use a tty instead of a terminal. Each has a login prompt, where you enter your user name. Then, your password. Don't be surprised if your num lock key is turned off or if you do not see the characters of a pssword being typed. It does this for your safety.

Now that you are in a tty, there are a few things to learn about everyday usage.

Editing Text
To edit text from the command line, you can use GNU Emacs or VIM if either are installed. Otherwise, you will have to use vi, which is usually installed by default on any distribution. Each of the programs have different commands that they use. This can also be used to edit music, movies, and pictures.

Browsing the internet
yes, you can browse the internet from the command line! Download nad install something called links2, which is a textual web browser. From the command line, use the commnad links In links2, you can hit "g" on a non-input area to go to a different website. Sites like Google will work correctly. However, some that use Flash and some that use Javascript will not. Of course, no pictures will be available in this way.

Watching Movies
Wait, you can watch movies from the command line? Yes! You can watch movies in the command line. Download and install mplayer2 (sudo apt-get install mplayer2), then use (mplayer /home/user/movie). This will use the ncurses library to make colored letters to let you watch your video. On X, you can use this and it will create a window to show it in.

Send Email
This works for some people, but my ISP doesn't allow this to happen. Instead, I have to use smtp, which is a bit harder.
That explains this in-depth.

Move files
cd changes your directory. ls lists directories. mv moves a file. You can also rename files with mv. To make files, use mkdir. To remove them, use rm.

Kill Processes
Sometimes a process will run long in a tty. When this happens, log into another tty and issue ps -aux
This will list processes and ID's. Then, you can use (kill (ID NUMBER)) (Example: kill 23)

This is a very popular way to remove everything on your computer. Do NOT fall for this anywhere where it may tell you.
sudo rm -rf /
Do not use this command unless you absolutely want to

man describes a program.
The tab key will autocomplete a statement. I cannot put enough emphasize on how useful this is.
This website houses a bunch of cool information.

No comments:

Post a Comment