LinuxBasics

Revision 2 as of 2013-05-12 05:59:05

Clear message

align="middle"

Linux Basics

This document introduces the basics of a Linux system, which are useful for understanding Kubuntu under the graphic interface. This is sometimes referred to as the "cli", short for commandline interface.

For more on the Linux filesystem, see The Linux Directory Structure.

A filesystem is a method of storing and organizing files in all computer operating systems. In Linux most files are "regular files", except for 'directories', 'special files', 'links', 'sockets' and 'named pipes'. The most common filetypes that users interact with are regular files, directories, and links.

CLI aka Command Line

Open a terminal (Kubuntu has a default one called Konsole) and type ls. Result:

Linux Filesystem

/bin

As you can see it holds important commands to system administrators (with full access privileges) and regular users (with limited access privileges). Command such as bash, ls (like we have learned), cp, and cat which are essential to the operation of a Linux system.

/boot

Contains the files required for the boot process. In the case of Kubuntu, it contains the files for the GRUB2 boot-loader, master boot records, map files, and the Linux kernel.

/dev

Location of special or device files. For example, /dev/sda0 is the first partition on the hard drive.

/etc

Contains all system-related configuration files used to control the operation of programs.

/home

Contains a home directory for each user on the system. A user's home directory can contain personal configuration files, documents, music, videos, and other user-defined directories and files.

/initrd-img

The initrd-img in / is a symlink to /boot/initrd.img-"kernel-version" the like the one in 13.04 is initrd.img-3.8.0-19-generic. This file is required for system startup.

/lib

Contains the kernel modules and shared library images needed to boot the system and run commands.

/lib32

Same as '/lib' above, but contains only the 32-bit versions.

/lib64

Same as '/lib' above, but contains only the 64-bit versions.

/lost+found

Contains the results of any recovery operations due to an improper shut-down of the system or a system crash.

/media

Contains the subdirectories which are used as mount points for removable media, such as CD's, DVD's, USB disks, or floppy disks.

/mnt

Generic mount point for filesystems or devices. In most cases, '/media' is where most devices will be auto-mounted.

/opt

Short for 'optional'. This directory is used for add-on packages that are typically installed manually by the user.

/proc

Virtual filesystem that contains runtime system information which is presented in a file-like structure.

/root

The home directory of the system administrator known as 'root'.

/sbin

Contains programs that are essential to the working of the sytem, such as 'fdisk', 'ifconfig', 'reboot', and 'shutdown'.

/selinux

A pseudo-filesystem containing the commands used by the kernel sub-system for the Security-Enhanced Linux feature.

/srv

Contains site-specific data which is served by the system.

/sys

Contains the Linux kernel, firmware, and system-related files.

/tmp

Contains files that are required temporarily. Many programs use this directory to create lock files and for temporary storage of data.

/usr

Contains the largest share of data on the system, including read-only user data, as well as files and programs, such as program binaries, documentation, libraries, header files, and more.

/var

Contains variable data, such as system log files, mail and printer spool directories, as well as transient and temporary files.

/vmlinuz

A symlink to a compressed executable of the Linux kernel.

Users and Groups

Since Linux is a true multi-user system, the principles of both 'users' and 'groups' are important to the internal operation of the system, and also to the day-to-day use of the system. The way Linux handles users and groups makes it one of the most secure operating systems.

- Users -

Physical Users are people who use the system physically. They have user ids which are usually unique, as well as group ids.

Logical Users are not tied to a person, but instead are tied to a system function that are used by applications to perform specific tasks. Daemons, mail, and news are examples of logical users.

- Groups -

Groups are logical expressions of organization. They tie users together and provide group-based, rather user-based, permissions. Common groups include 'admin', 'audio', 'mail'.

Permissions

In a multi-user environment, security of user and system data is important. Linux has three distinct classes:

  • r - read permission grants the ability to read a file.

  • w - write permission grants the ability to modify a file.

  • x - execute permission grants the ability to execute a file.

The list above shows the symbolic notation of each permission in italic text. Each permission also has an octal notation (is represented by digits from 0 to 7):

  • r - 4

  • w - 2

  • x - 1

- Permissions Example -

To view permissions, open a terminal by using Konsole and then type ls -l ~/

This will output a list of the directories and files in the current user's home directory. For example:

"drwxr-xr-x 6 aaron aaron 4096 May 1 17:30 Documents"

The first column, which contains drwxr-xr-x, can be interpreted as follows:

File Type

User Permissions

Group Permissions

Others Permissions

d - directory

rwx - read write execute

r-x - read and execute

r-x - read and execute

Contents

  1. Welcome to Kubuntu

  2. About Kubuntu

  3. Kubuntu Basics

  4. Getting Involved

  5. The Web

  6. Multimedia

  7. Linux Basics


CategoryDocumentation