Jump to content
ZeroCold

Linux Terminal Introduction

Recommended Posts

Linux Terminal Introduction

A beginners introduction to the very powerful linux terminal

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 (Cygwin Information and Installation) which provides a linux-like environment in windows. If you looking to try out linux, there is a very user friendly distribution called ubuntu (Ubuntu Home Page | Ubuntu), 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:

prompt.png

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:

USERNAME@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.

ls

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.

ls -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 ".").

cd

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:

cd.png

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:

gedit.png

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

openmovieeditor.png

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.

tab.png

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.

cat.png

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.

:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...