Categories:


- System -

- Internet -

- Video -

- Audio -

- Pictures -

- Other -


HOW TO install Ubuntu - complete guide

List of everyday used applications (in process)








HOW TO use terminal (beginners tips&tricks)



Ubuntuhowtos.com is back.
I would like to do a simple list that explains how to use terminal. In linux he will be your biggest friend if you accept him:).

Lets start with organisation of folder since it's somewhat different from that in Windows. In windows you have C:/ , D:/ , ... and so on. In Linux all you have is /. Now you ask yourself where do all of my partitions go. The answer is simple. They go wherever you want. To be precise they go to whatever folder you want to but by default they go to /media/.
Simpler way to mount (that's how its called when we 'put some disk partition in some folder') partition is to Click on Places in menu in upper left corner and selecting the partition. But you can do this from terminal by typing:

sudo mount /dev/sda1 /media/some_folder

The explanation:
sudo - you have to be the administrator (super user do) to do this
mount - mounting command
/dev/sda1 - partition you want to mount
/media/some_folder - folder where your partition will show

If you are new to this the line above will need some more explanation. Lets start with /dev/sda1. This is the partition you want to mount. It will not always be /dev/sda1, it could change to any /dev/sdxy , where x is the number of disk and y is the number of partition. So how do you know what disk or what partition is the partition you want to mount? It's simple type:

sudo fdisk -l

I will not discuss the output here, give it a minute or two to study and you will get it.
You will probably not use the mount command much but its worth to learn or better to say to learn that this can be done and its not hard to do. Also you can use mount command to mount *.iso files. I believe that you will need the -o loop at the end of the line to get it done. Anyway, if you dont use it the output will tell you to "try using -o loop at the end of the line".

That will be enough on the mount and fdisk commands. To find out more type:

man fdisk

this will give you manual for fdisk. You can use the same thing to find more about any command.

Next the /home/username folder, where username is your user name. This is where most of configuration files for your programs are stored. Simplest way to get here is to type:

cd ~

This ~ key is located at the left of the number 1, don't forget to hold down shift. Longer way is to type:

cd /home/username

Listing files in some directory is done by following command:

ls

or to get more output:

ls -lah

l will show the files as a list, a will show the hidden files, and h will show the size of files (except folders) in human form. That means in kB and MB not in blocks.
To go one folder up you type:

cd ..

Creating new folders is done by command:

mkdir new_folder

If you put space instead of _ you will get two folders, new and folder.
Copying files is done by cp command, for example:

cp /media/disk-1/music/song.mp3 ~/Desktop

will coppy song.mp3 from some partition mounted to /media/disk-1/ and folder music to your desktop. Notice the big D in Desktop. In Linux names of the folders and files are CASE SENSITIVE so if you write ~/desktop it will not work because there is no such folder.
Moving and renaming (the same thing) is done with mv command. It's used the same as cp command.

To make life easier use the TAB key, the one on the left of q. It will finish the names of the files you started to write. For example you want to rename the file %this%_is_SOME_s94ng_i_wAnT%toRenaMe.mp3. It would be somewhat frustrating to write this so what do you do? Type just first letter and press tab twice. If there is only one file starting with % in that folder it will be auto-finished. If there are two who start with %this it will auto-finish to the %this and list the two files so all you need to do is type next letter in which the two differ and press TAB again. Try testing it by creating two folders:

mkdir folder13254315151 folder214415153451
cd f "now press tab twice"

You can remove folders as follows:

rmdir folder*

This will delete all folders whose names start with folder. You can use the 'wildcard' * any way you please. For example:

rmmdir *folder
rm fi*le

The first commmand deletes all FOLDERS that end with folder, and second delete all FILES that start with fi and end with le.
If you want to delete some folder containing subfolders you will need to use the following command:

rm -R folder

Here you can find the "cheat sheet" containing all the basic Linux commands.

Lets go a bit more "advanced" here. One thing where terminal comes REALLY handy is when you want to do something with all of the files in one folder. And for that you use xargs. For example you want to rename all files in your folder so they start with X. You do the following:

ls | xargs -i mv {} X{}

The ls command list all files in folder you're at. Next the | xargs -i tells to grab every line output and for it do the mv {} X{}. where {} is the line output or file name for ls command. Here you can see more useful usage of this command. I think you can agree now that terminal has its advantages.
Oh, one more thing I almost forgot. When you are browsing the Nautilus (thats Widnows Explorer in Linux) it is handy to open terminal in the folder you are at. You can't do this by default but its very simple to obtain this power :). In terminal type:

sudo apt-get install nautilus-open-terminal

Hope this helps you getting started with terminal and shows some of the advantages.




You can leave a comment at the homepage.



SEARCH



  • Ubuntu official

  • Ubuntuguide, helps you start using Ubuntu

  • Order latest Ubuntu cd at your doorstep, for FREE


  • If you have problems installing programs with 'apt-get' or 'aptitude' be sure you have enabled universe repositories.
    Click here to see how to enable them.