Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

LInux Terminal Introduction


LInux Terminal Introduction

By stealth- avatarstealth- | 11696 Reads |
0     0

Welcome,

I've noticed a lack of linux articles on this site, so I thought I would post one (although its rather basic, it should definitely help people new to linux). If you are in a windows environment, and still want to try this out for yourself, there is a program called cygwin (www.cygwin.com/) which provides a linux-like environment in windows. If you looking to try out linux, there is a very user friendly distribution called ubuntu (www.ubuntu.com), which you can run with no changes to your system. Linux is not all command line, if anyone who reads this happens to be that oblivious. In fact, the linux GUI's (there are multiple avaliable) can do alot of things the windows one cant.

Now, enough introductions and windows ranting :) You can get to a terminal in linux by pressing ctrl+alt+F1 or by searching through your programs list for something such as "terminal" or "konsole" When you open your terminal, you might be wondering what the first thing you see is supposed to mean:

Your's will be different, and its called a prompt. It tells you information about your computer and who and where you are in the system. This is the syntax:

markupUSERNAME@HOSTNAME:CURRENTDIR$

You might be thinking: "What kind of directory is ??". Well, in linux "" is a shortened way of saying "your home directory". For instance, mine actually is: /home/stealth/, but it becomes tiresome to print and read constantly, so they use a much shorter character.

markupls

This is the most common command for me. It's a cut down form of the word LiSt and does exactly what it sounds like, it lists the contents of the current directory. You should see exactly whats in your home directory. Now, this is a command that takes "arguements". You can give it sub commands to get exactly what you want.

markupls -a

The - means that i want to start an arguement, and the "a" is the specific arguement, in this program, "a" lists all the directories. By default, ls hides the hidden directories (ones that start with a ".").

markupcd

Change Directory. This command allows you to manuver through your filesystem. / is the root directory in linux. Linux does not use C:/ or D:/ drives, but instead it uses mountpoints. Each drive will be mounted under a position in the filesystem (most likely /media/). So, if a device, called "device", was plugged in and mounted, and you wanted to go to that directory via command line, you would "cd /media/device/". Then, your terminal might look something like this:

Pretty cool, huh? This is not even the tip of the iceburg. The linux console controls everything. Lets say you wanted to run a program, you can run that program just by typing its name:

However, what if you dont know the right program command?

Okay, bummer. So what can we do? Bash (the terminal) comes with something called tab-completion. Basically, if you dont know the whole name of a file, command, program, etc (or are just to lazy to finish typing), pressing tab will let bash finish it for you.

There was more than one possible outcome that bash could have entered for me, so rather than guessing one, it told me the possible outcomes. You might not have open movie editor installed on your system, so that particular scenerio might have gone differently for you. Another great command is "cat". Cat prints the output of a file.

Now, if I opened /media/device/fire4.txt, I would see that the file contained "You idiot your spelled file4.txt wrong!". Another great command is "nano". nano is a text editor that allows you to edit files, or create them. Once in nano, it takes up your full screen, and you can get out by pressing ctrl+x, then pressing y or n to save or not save your file (if you made any changes).

Also, you can delete files with the rm command. The -r will delete things recursively, meaning that it will delete things in sub-directories (useful for deleting directories which aren't empty), so be careful. Like I said, the terminal can be very powerful (which is why I wont explain the su or sudo command here).

One last command I will teach you is "man". man stands for MANual. Typing "man commandhere" will bring up the manual page for that command. The manuals are extremely detailed and teach you everything you need to know about that command. Some commands I recommend looking into are: mount, sudo, su, umount, ssh, the program installer for your distro, touch, and mkdir.

Well, I hope whoever reads this was able to learn something, and if there is interest I might make some more linux-based articles :) Stealth-

Comments
ghost's avatar
ghost 15 years ago

This is wayyy to basic. There's already about 5 articles that talk about this, and they manage to cover more commands that you do. Next time make one that covers something more interesting about Linux, not just basic shit with the shell. If you make it about the shell, at least do something more interesting. Oh, and nano sucks, learn to use vim. I'm rating average.

ynori7's avatar
ynori7 15 years ago

As far as quality, it's not bad. As far as content, it's very very basic. And why did you capitalize the I in Linux in your title? By the way, Windows' cmd also has tab completion; it's fairly standard now. I'll rate this 'good'.

korg's avatar
korg 15 years ago

Nice layout and images but the info just stinks man, Like 1st grade style. Yes the tab completion has been in xp for yrs.

ghost's avatar
ghost 15 years ago

read the bash_builtins by typing "man source" through a bash shell to start; learn to read the instructions for programs with google and man from the beginning, learn google based problem solving - it will be much more comfortable for you and people around you. Also i would suggest to use vim or vi its way better than nano.

stealth-'s avatar
stealth- 14 years ago

Sorry guys I know this stuff is basic but I figured it would be of use to beginners. I'll try to orientate my future articles to a more technically-familiar audience.