Hi everyone, welcome to my series about Linux where I'm giving an introduction to Linux.
Today we'll look at some really basic stuff, so you get used to your new system. I'll try to give you some basics but can't tell you everything, so if you want to know something ask here or just simply search it online. Afterwards we'll go deeper and deeper. I'll be doing this tutorial with Ubuntu since it's the most popular one, I'll use a virtual box for the moment because I'm planning to show you how to set it up in cool personal way and I want to be in the same state as you guys, so please don't wonder why I'm using a VM. If you have an other distro, please google it or ask here. Good reading!
If you have no idea what Linux is, please check out my first post about Linux:
Introduction to Linux
This is what the console looks like when you open it. But what does the text mean? I put the meaning at the place where the text is:
UserLoggedIn@MachineName:CurrentLocation:~$
where the symbol "~" means, home directory, which is your home folder.
$ is the interpreter, which here is bash.
You can of course change the colors of the terminal. :)
On other distros you might find it written differently but in the end you'll get it easily.
There is one cool terminal for beginners, it's called "fish". I still enjoy using it sometimes! :D But I'll show you how to install fish and other programs later.
If you want to go to the folder Downloads now you can do this.
The cd command gets you to the folder you want. As you see in the second line our current location has changed.
But sometimes it's easier to give the whole path instead of this combinations. Imagine the situation you're around 10 folders "deep" and you want to access something from your home folder. Then it's easier to write the whole path.
So the whole path to the home folder is:
/home/yourUsername
so guess what you have to type now?
or you can simply type: cd ~ which means the same
Okay, now you might wonder how much up you can go: The starting point is /, which as you see is the most left symbol of the whole path.
check it yourself by going to / and trying to go up, nothing we'll change.
Talking about paths, I want to add that, you have relative paths, which start at the current directory and absolute paths which start at /
From / on you can checkout the file hierachy, which I won't talk right now much about. But here is a graphic for a little bit of orientation in it.
Use the command
ls
It will display you all files and folders in the current folder.
You can of course give the command with an argument, for example you're in the home folder. And you type
ls Downloads/Movies/illegalDownload/
It will now look in the folder and show your hopefully empty illegalDownload folder ;)
As we've seen, there are different commands. (The two I showed aren't the only two ones, but the most basic ones.)
There are different options: firstly there are single letter options and multi-letter options.
For single letter options here is an example
ls -a
For multi letter options an example
ls --all
They do exactly the same, they show the hidden things like the link to the folder above.
ls -h
It shows you the sizes too in the list of files (easy to read for humans)
ls -l
shows you the sizes like with -h, but it's harder to read.
write "man" and put your command as argument if you want to learn more about some command.
Example: man ls
Result:
And before you think you have to complete always everything:
If you want to go to Downloads, try:
cd D*hitTABonKeyboard*
This will probably display you
Documents Downloads
Then continue typing until you have:
cd Dow
and then hit the TAB. It will autocomplete then if you don't have anything starting with "Dow".
use your array buttons on the keyboard. Go up for previous ones.
Or press: Ctrl+R for searching your command history.
Btw, It will show you, that you typed: ^R, which means that you entered Ctrl+R
When looking for files, use *, this will be replaced by anything.
So if you're looking for .pdf files, type: ls *.pdf
Which will show you all pdf files.
Or when removing files this helps much:
rm someProject-*
removes all files starting with someProject-
But of course it will only remove them if you named all your files of the project after a naming pattern :D
rm -v, gives you more information on what was deleted then only rm.
Ctrl + C
which will againg display ^C
This is very usefull, when something doesn't stop, for example a program with never ending loop.
The superuser has more rights than the average user. He can go to all users home folders, as normal user you can only go to your own one. He can make big changes to the system.
But he's the only one who can install software. (Similar to Window's Admin rights)
sudo su
This is the command that sets you to superuser permanently, if you know the password of the admin of the computer. DON'T USE THIS AS A BEGINNER.
Linux will tell you when you wanted to execute a command that needs. Then you can type
sudo !!
only sudo means superuserrights for this action.
And !! is the command previously executed.
Or if you know that you need the rights, type directly:
sudo YOURCOMMAND
Okay guys. That's enough for today. Next time we'll look at how to install programs and I'll show you more programs. Wanted that today but I'm writing now for too long and nobody we'll reach this part. So if you do, let me know :D
Please correct me if I'm wrong somewhere!!! I was really tired writing this, so sorry, I still hope you enjoyed it.
Cheers!