Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.

Translations of this page?:

VARIOUS Quick introduction to Linux

This isn't intended to be an indepth look into the depths of Linux, rather a quick introduction to the major differences and stumbling blocks to get you on your way

User Permissions

Linux unlike Windows is designed to be a multiuser system, that means that users need to be protected from each other, Jill wouldn't want Jack being able to delete her files and the owners of the system wouldn't want all users being able to install anything they wanted, what would stop them installing viruses? These protections are enforced through what are known as user permissions, broadly every file has 3 sets of 3 permissions, those are read write and execute permissions, over the owner, your group, and everyone, this means if you want to be the only one to edit a document but allow everyone to read it, you can.

What this means in practice

Sometimes you are asked to enter a password, such as when installing software. This is because in general you only have permission to modify files within your own home folder, software, by default is installed outside of this directory and so the system won't let you do it. The solution is to temporarily elevate your privileges, this is known as running as root or running as the super user, because you temporarily give yourself the power to do anything on the system, that is why it isn't recommended to run as root all the time.

Getting Super User Privileges / Running as Root

The main place you notice that you need superuser privileges is in the terminal, that is why for some things you need to prefix some commands with 'sudo' (think of it as Super User DO). that allows you to do something as root, eg:

sudo apt-get install firefox 

Which would install 'firefox'.

A closely related command is 'gksu' this does the same but for GUI applications using the GTK toolkit, eg:

gksu synaptic

If you try to run something as the normal user, when the program requires root you will probably get an error message something like the following:

E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

(this is the error message of apt-get install)

Command 'synaptic' is available in '/usr/sbin/synaptic'
The command could not be located because '/usr/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative priviledges associated with your user account.
bash: synaptic: command not found

(this is the one for synaptic)

When using sudo you will be asked to enter your password, but it won't give you any visual feedback that the password is going in, don't worry this is normal, just enter your password and press enter, if its wrong it will tell you.

If you use gksu, you will get a pop-up asking you to enter your password, this will give you visual feedback.

Remember that applications launched from the menu or a keybinding or autostarted will also require you to add the gksu prefix (dont use sudo, as there wont be a pop-up to actually type your password into).

Sudo or Gksu?

Many people will advise you to use 'sudo' for everything that requires superuser privileges, while in general this is ok, in certain circumstances it can cause problems with GUI applications, so its best to get in the habit of using 'gksu' for launching GUI applications, if you need to. See this article for details

Package Management

In Windows the normal route to installing something is to search the internet, download a package go through the installer and then run. Linux uses central repositories where all programs are stored, the advantage of this approach is that the software can be tested and tweaked to ensure it work with a particular distribution and is bug and virus free. It also ensures that you have all the dependencies, (other software and libraries an application relies on to function) installed. It also means that updates for all applications can be handled automatically, no more need to go looking around to see if the newest version of X is out yet. You can search and install software using a package management application, CrunchBang has 2, for the terminal you have apt-get and you have synaptic, a GUI application, in the repository you will probably find 99% of the programs you need, this should be your first stop when looking for software, its a lot easier and safer.

Installation using Synaptic

Synaptic is available in the menu under System –> Package Manager, after you have entered your password you will be shown the main screen, there is a search box near the top that you can use to search for applications either using the specific title or a general term such as 'web browser', once you have found what you're looking for right click on it and select 'mark for installation', then when you're ready click 'apply', and the packages will be installed, simple.

Installation using Apt-get

Installation using Apt-get is as simple as entering in a terminal:

sudo apt-get install firefox

to search for an application:

sudo apt-cache search web browser

I'll expand on using Apt-get below.

Keeping your system up to date

You need to keep you system up to date, both to protect you from vulnerabilities and to get extra features, all of your applications installed through the package manager, will be updated through the package manager, so you don't need to go running about to different web sites to check for updates.

Updating using Synaptic

to update you system using synaptic, launch synaptic, click reload to reload the package list, then click mark all upgrades then click apply.

Updating using System Update

CrunchBang's own update script can be accessed from the menu, under system –> system updates.

Updating using Apt-get

Enter in a terminal:

sudo apt-get update

and then:

sudo apt-get upgrade

The Terminal

The terminal is accessible in two ways the first and easiest way is through the menu under the heading 'terminal', this starts the APPLICATIONS Terminator terminal emulator. the second way is with the shortcut keys ctrl alt 1-6 (ctrl-alt 7 brings you back here)

The Terminal is used much more in the Linux world, than in the Windows world, this is partly because the Linux Terminal is much more powerful, many instructions you read in this wiki, and from other places will give you instructions using the terminal. Firstly this is to make it portable, there is a much larger variety of graphical applications that aren't guaranteed to be installed, there is a much greater number of terminal applications that are guaranteed to be on every system. Secondly the instructions can be more succinct, compare:

sudo apt-get install firefox


click menu --> system --> package manager, click search, type firefox, select firefox and right click and select 'mark for installation' then click apply.

both do the same, both install firefox, which one is easier to type and less likely to be misinterpreted? also many more systems have apt-get than synaptic (the graphical package manager) so you might potentially have to rewrite the instructions for users who use something else.

The Terminal In 5 Minutes

Again this isn't meant to make you an expert just to give you the basics to work from.

First a quick note: '~' generally means your home directory, it expands to /home/yourusername this is where you should store all you personal files.

cd and ls

The two most basic commands are probably 'cd' and 'ls', 'cd' stands for Change Directory, and changes directory, 'ls' stands for LiSt and lists the files and directories in your current directory. try them out try typing ls in the terminal you should get output similar to

>backup  Desktop  documents  downloads  images  music  PDF  tmp  videos

they are blue because they're directories, files are white, and executable files are green.

to get more information type 'ls -l' (try it):

>ls -l
>drwxr--r--  3 user user 4.0K 29-10-2009 22:16 images

You will get lots of info such as

drwxr--r--  3 user user 4.0K 29-10-2009 22:16 images

This tells me its a directory(the 'd') everyone can read this directory, but only I can write to and execute it, denoted by the 3 groups 'rwx' for user,group,everyone. I know that user is the owner, that its 4k in size and that it was last modified on the 29th October 2009.

Another useful ls option is 'ls -a', this will probably list a few more files, a few will start with a fullstop '.' these are hidden files, and generally used for configuration, you may also see some ending with '~' this has nothing to do with expanding your home path, and is just a naming convention for backup files, generally if a file is saved and modified the old file is saved with a '~' suffix.

Back to cd. Type:

>cd ~/images

This is the same as typing 'cd images', except 'cd images' will only work if images is in the current directory, remember '~' expands to your home path so is the same as 'cd /home/yourusername/images', then type 'ls', you should see one directory called wallpapers, next type 'cd'<space><tab>, the tab key trys to autocomplete, as there aren't any other options it knows it has to be wallpaper, the space is there to stop it trying to autocomplete cd, you may be trying to type cdparanoia for all the computer knows.

Now try.

>cd ..

'..' always refers to the previous directory, if you kept entering 'cd ..' it would eventually take you back to the root of the file system also known as '/'.


The other basic command is 'cp' which copies.

>cp ~/file.txt ~/Documents/file.txt

will copy the file to your Documents directory, closely related to cp is 'mv' which moves files rather than copying them, its also useful for renaming:

>mv file.txt file1.txt

Will rename file.txt to file1.txt.


A command you will often see is:

>sudo apt-get install program

This is actually 2 commands 'sudo' allows you to do things only the administrator is allowed to do, see User Permissions above, this is why you need to enter a password, 'apt-get' is a package management tool, also see above, and is used for managing applications, the install command installs new software, other options include

apt-get remove program

remove a program but keep configuration files

apt-get purge program

remove the program and all configuration files

apt-cache search program

search for a particular program, 'apt-cache search web browser' will search the data base for web browsers and give you a list.

apt-cache show program

will show you more details on a particular program, say your previous search brought up 'elinks', whats that?, 'apt-cache show elinks' will tell you.

man and apropos

The man command is extremely useful, it shows you the manual pages for a particular program, 'man ls' will show you the documentation for ls, it will show you the -a flag and the -l flag and many more.

another useful command is 'apropos' this will search your installed programs for programs matching the search term, so 'apropos calculator' should return a list of calculators on your system, useful if you've forgotten the name of something, or don't know what does what.

Potentially Harmful Commands

unfortunately not everyone is so nice when giving advice on forums and so you need to be aware of some of the commands that can be misused.

'rm' is the remove command, as you can imagine if used incorrectly can be very damaging, of course it has legitimate uses

rm file.txt

will remove file.txt, be it can also be misused, probably the worst example is 'sudo rm -rf /', that will delete everything on your computer, almost as bad is 'rm -rf ~', that just deletes all of your personal files. Please bear in mind though that these don't necessarily have to be used maliciously, for example what if you wanted to remove an old directory from your home folder and you typed 'rm -rf ~ /olddirectory', notice the space ?, that will delete /olddirectory and ~, your home folder. in those circumstances it may be a good idea to add the '-i' flag ie 'rm -rfi', that will ask for confirmation before deleting each file.

another command although not harmful in itself, can be coupled with others and so it is wise to be extra vigilant when using it, that command is 'sudo', which allows you to do virtually anything you want, including installing programs, or deleting them, closely related is gksu, which is recommended for use with graphical applications.

Further Reading
explanation_of_linux.txt · Last modified: 2012/07/16 15:42 by hq
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported

Powered by DokuWiki. Hosted by Linode.
Copyright © 2010 CrunchBang Linux.
Proudly powered by Debian GNU/Linux.
Debian is a registered trademark of Software in the Public Interest, Inc.