Also acta

Debian Squeeze with OpenBox

Debian GNU/Linux - Squeeze with OpenBox
If you can walk and chew gum at the same time, you can run GNU/Linux

debian tutorials is built on and runs on Debian.


Creative Commons License
Linux Conventions Print E-mail
Written by machiner   
Monday, 25 April 2005 11:03
You will find that Linux is a different animal than what you are used to if you are coming from a Windows computing environment. Immediately see the difference on your desktop. Whereas in Windows, if you double-click your "My Computer" icon on your desktop, Explorer opens showing you graphical representations of your drives. Linux is different. Everything is a file, and these files are in directories. Therefore when you open your File Manager you will see something completely foreign to you. You will see directories instead of icons.

This tutorial is not complete, maybe it never will be. I'm not even sure it knows where it wants to go...

The very first thing that I think you should know -- because you will certainly use the command line or a terminal at least one time:

# preceding any command at the command line means that you will be root
$ or % means that you will be a regular user, you

Very Important:

Linux/Unix systems are case sensitive. What this means to you is learn to type. Seriously, the file Image1.png is most certainly not the same as image1.png. Say it with me...Linux is case sensitive. It's in the details, man.

A file system directory structure in Linux could be the following:

/bin -- Command binaries, or - Programs (like C:\Program Files)
/boot -- Your systems boot files. You'll find Grub in here.
/dev -- Your system devices: hard drives, web-cams, etc.
/etc -- Your system's configuration files, example, /etc/resolv.conf
/home -- Personal directories for your system's users. Your program settings and data is here, your web browser settings for example.
/lib -- The shared library directory. Like the System32 directory in Windows.
/mnt -- Directory for mounting a device, hard drive (file system) temporarily
/media -- New, location of dynamically mounted drives, your cd-rom is here and usb-stick.
/proc -- Doesn't really exist. Created dynamically for system information.
/root -- The root user's home directory. Back off.
/sbin -- System binaries, more programs.
/tmp -- Temporary files
/usr -- Sharable read-only data, containing all user binaries, documentation, etc.
/var -- Non-shared system file variable data directory. Phew! /var/www is where web sites go by default on Debian, /var/lib/mysql for your databases.
/opt -- Common directory for user installed programs. Shared files.

Another set of conventions you should be aware of is the device naming scheme. Without getting too technical I will tell you that Linux allocates the following names to mounted devices:

/dev/fd0 -- First floppy drive. If you have others Linux will name them thusly: /dev/fd1, dev/fd2, etc. /dev/hda -- This is your "master" IDE drive. SCSI drives are named "sda". If you have more than one partition on a drive you can expect to see the following scheme:


As well, if you have more than one IDE (SCSI) drive each drive will have a naming convention ascending the alphabet in order. Example, first hard drive is "hda" second drive is "hdb", etc. Same scheming follows for partitions.

/dev/hdc -- this is your "master" IDE cd-rom drive. From the convention you can surmise that the "slave", or secondary cd-rom device will be named "hdd", and on it goes.

If you poke around in your /dev directory you will see that many "devices" have entries here. Devices like your audio /dev/dsp or /dev/snd. These devices also correspond to aspects of your system's architecture that you need not concern yourself with and are created automatically by your system. On occasion you may have to change the chmod value of a device like /dev/snd to allow sound under certain conditions to certain software. This is outside the scope of this article.

Just for giggles, here is a copy of my /etc/fstab file. This file list the mount points for the system. It's here so you can glean info.

# /etc/fstab: static file system information.
# file system   mount point     type    options         dump   pass
proc            /proc           proc    defaults        0       0

 If you dual-boot with an NTFS Windows partition you may have a line like the following:
/dev/hda1       /mnt/ntfs       ntfs   noauto,users,ro,umask=0  1  0
/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda2       /home           ext3    defaults        0       2
#/dev/hda3       swap            swap    sw              0       0
#/dev/hdb2       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   iso9660 ro,user,noauto  0       0
/dev/hdd        /media/cdrom1   iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
/dev/hdb1       /mnt/vault      ext3    rw,auto          0       0

I commented out my swap partition because I increased my ram to a 1.5GB, I don't really need a swap partition anymore. Also, take a look at the last entry - it's my backup "vault" on my "slave" drive. Notice the OPTIONS: I can read and write to it and it is automatically mounted. If I added "user" like the entry preceding this one then an icon for my backup drive would appear on my desktop.

And speaking of seeing your windows partitions in Linux, let's mount one. If you don't know your partition structure open a terminal, become root and run the fdisk command:

# fdisk -l

Now you can see that the Windows partition that you want to mount is at /dev/hda2 (as an example). So we can mount it now but don't forget to make a directory for it in your /mnt directory:

# mkdir /mnt/winfat32.

To mount the partition run the following command:

# mount -t vfat /dev/hdb2 /mnt/winfat32

To automatically mount your Windows partition at boot time add the following line to your /etc/fstab file:

/dev/hda2        /mnt/winfat32  vfat    rw,user,auto  0       0

If the partition in question is formatted NTFS add the following line to your fstab file instead:

/dev/hdb2        /mnt/ntfs  ntfs noatime,defaults,users,ro,umask=0 0 0

[TIP: if you just changed your /etc/fstab file and don't want to reboot to see the changes run # mount -a as root]

Other people have written in far greater depth - if you really want to learn about this and other Linux conventions, sensibilities, methods and/or procedures I suggest you do a little research ( fstab options ). See below...

I have found a website that delves much deeper than I do. Feel free to browse this site and spend days reading up on this and other Linux subjects. System Admin Guide

I just wanted to add a little something about running commands in the terminal. Many people see a command or hear how to execute such in a conversation and it just soars miles over their heads. It shouldn't. You're just not used to them that's all.

Doesn't matter your OS, you may need to actually type a direct command to your computer one day. Commands all have options to accomplish the task you want to. Say I wanted to move a file to another directory. Cake. I open my terminal, cd (change directory) to the directory (folder) containing the file...or not. Say I wanted to paint my house. I would issue

$ paint -C 1 -c flaming-yellow --when-cloudy --on-a-wednesday

OK I got a little silly with the switches but you can see that I issued the command "paint" but I threw some variables in. Simply enough I wanted paint to paint my house:

  • -C 1 is 1 coat
  • -c flaming-yellow is pretty obvious
  • you get the idea

    If I wanted to run grep to search for strings and I forgot the syntax I could issue the following at the command line:

    $ grep --help

    I would receive the following response

    machiner@brokenhip:~$ grep --help
    Usage: grep [OPTION]... PATTERN [FILE] ...
    Search for PATTERN in each FILE or standard input.
    Example: grep -i 'hello world' menu.h main.c
    Regexp selection and interpretation:
      -E, --extended-regexp     PATTERN is an extended regular expression
      -F, --fixed-strings       PATTERN is a set of newline-separated strings
      -G, --basic-regexp        PATTERN is a basic regular expression
      -P, --perl-regexp         PATTERN is a Perl regular expression
      -e, --regexp=PATTERN      use PATTERN as a regular expression
      -f, --file=FILE           obtain PATTERN from FILE
      -i, --ignore-case         ignore case distinctions
      -w, --word-regexp         force PATTERN to match only whole words
      -x, --line-regexp         force PATTERN to match only whole lines
      -z, --null-data           a data line ends in 0 byte, not newline
      -s, --no-messages         suppress error messages
      -v, --invert-match        select non-matching lines
      -V, --version             print version information and exit
          --help                display this help and exit
          --mmap                use memory-mapped input if possible
    Output control:
      -m, --max-count=NUM       stop after NUM matches
      -b, --byte-offset         print the byte offset with output lines
      -n, --line-number         print line number with output lines
          --line-buffered       flush output on every line
      -H, --with-filename       print the filename for each match
      -h, --no-filename         suppress the prefixing filename on output
          --label=LABEL         print LABEL as filename for standard input
      -o, --only-matching       show only the part of a line matching PATTERN
      -q, --quiet, --silent     suppress all normal output
          --binary-files=TYPE   assume that binary files are TYPE
                                TYPE is 'binary', 'text', or 'without-match'
      -a, --text                equivalent to --binary-files=text
      -I                        equivalent to --binary-files=without-match
      -d, --directories=ACTION  how to handle directories
                                ACTION is 'read', 'recurse', or 'skip'
      -D, --devices=ACTION      how to handle devices, FIFOs and sockets
                                ACTION is 'read' or 'skip'
      -R, -r, --recursive       equivalent to --directories=recurse
          --include=PATTERN     files that match PATTERN will be examined
          --exclude=PATTERN     files that match PATTERN will be skipped.
          --exclude-from=FILE   files that match PATTERN in FILE will be skipped.
      -L, --files-without-match only print FILE names containing no match
      -l, --files-with-matches  only print FILE names containing matches
      -c, --count               only print a count of matching lines per FILE
      -Z, --null                print 0 byte after FILE name
    Context control:
      -B, --before-context=NUM  print NUM lines of leading context
      -A, --after-context=NUM   print NUM lines of trailing context
      -C, --context=NUM         print NUM lines of output context
      -NUM                      same as --context=NUM
          --colour[=WHEN]       use markers to distinguish the matching string
                                WHEN may be `always', `never' or `auto'.
      -U, --binary              do not strip CR characters at EOL (MSDOS)
      -u, --unix-byte-offsets   report offsets as if CRs were not there (MSDOS)
    `egrep' means `grep -E'.  `fgrep' means `grep -F'.
    With no FILE, or when FILE is -, read standard input.  If less than
    two FILEs given, assume -h.  Exit status is 0 if match, 1 if no match,
    and 2 if trouble.
    Report bugs to [
     This e-mail address is being protected from spambots. You need JavaScript enabled to view it


    Where are newly my installed apps?

    Many people new to Linux wonder where the programs they install goto. Well, you will not find a C:\Progra~1, I mean: C:\Program Files anywhere on your Linux box. The programs that your Debian system installs, say with apt (or the front-end - Synaptic) will be installed to /usr/bin. The programs that you compile and install (./configure  make  make install) usually goto /usr/local/bin. There are other places, some java apps that you install as root will goto /opt. Others still will create a bin directory in your /home directory.

    So your environmental variables will include: /usr/bin, /usr/local/bin, /usr/sbin, /usr/local/sbin, ~/bin. You can always alter these, add to them, etc. As well, you may prefix an install location when configuring your install like this:
    ./configure --prefix=/install/directory.
    There are many instances when you would add a prefix string to your installs.

  • Last Updated on Friday, 27 February 2009 12:06