Study of Linux File System and Basic Commands
TITLE: Study of
basic Linux Commands
OBJECTIVE:
1. To
identify the origins of UNIX and how LINUX is related to UNIX.
2. To
interpret various OS functions used in LINUX / Ubuntu by learning basic
commands.
THEORY:
UNIX, which is not an acronym,
was developed by some of the members of the Multics team at the bell labs
starting in the late 1960's by many of the same people who helped create
the C programming language. The UNIX today, however, is not just the work of a
couple of programmers. Other organizations, institutes, and other individuals
contributed significant additions to the system we now know today.
Salient features of UNIX:-
The UNIX
OS offers several salient features, the important of which are discussed below.
1. Multi user
capability
2. Multitasking
capability
3. Communication
4. Security
5. Portability
Linux is a free version of UNIX (or UN*X). The free part is not meat in money terms but rather that the source
code for Linux is freely available for inspection, modification and what you
feel you can do.
Developed by Linus Torvalds and further elaborated by a number of
developers throughout the world, Linux is a freely available multitasking and
multiuser operating system. From the outset, Linux was placed under General Public License (GPL).
The system can be distributed, used, and expanded free of charge. In this way,
developers have access to all the source codes, thus being able to integrate
new functions or to find and eliminate programming bugs quickly. Thereby
drivers for new adapters (SCSI controller, graphics cards, etc.) can be
integrated very rapidly.
Linux is a multitask and
multiuser operating system. An operating system is a collection of programs
that run in a computer so that a person can easily access the hardware and all
resources of the computers. In this operating system is the big program that
makes your computer life easy (or difficult, if the operating system is a bad
one).
Linux is portable to any hardware platform. Linux is secure and versatile.
The security model used in Linux is based on the UNIX idea of security, which
is known to be robust and of proven quality. But Linux is not only fit for use
as a fort against enemy attacks from the Internet: it will adapt equally to
other situations, utilizing the same high standards for security. Your
development machine or control station will be as secure as your firewall.
A multitask operating system is capable of doing several tasks at the
same time. A multiuser operating
system has a concept of "user quote” a way to identify the person that is
using the system, and can allow different users to perform different task in
the computer, and protect one user's tasks from interfering with another user's
programs.
Some terminology:
Shell: this is a program in the system that allows you
to give the commands you want toexecute. It is the basic programs that connect
you to the operating system.
Process: any task that you run in the system is called a
process (again, a process is somethinga little more complex than just a task,
but that definition is good enough to start).
File: a part of the hard disk that contains data owned
by a user of the system. X-windows (or
simply windows): this is a mode of Linux where your screen (monitor) can
besplit in small "parts" called windows, that allow you to do several
things at the same time (or rather change from one task to another easily) and
view graphics in a nice way.
Text
terminal: a monitor that has only the
capability to display text stuff, no graphics (orperhaps a very basic graphics
display).
Session: the
time you spend between logging on in the system and logging out of the system.
The LINUX file system:-
"On a LINUX system, everything is a file; if
something is not a file, it is a process." LINUX treats everything it knows and understands as a file. All
utilities,applications, data in LINUX is stored as files. The LINUX file system
resembles an upside down tree. Thus, the file system begins with a directory
called root. The root directory is
denoted as slash (/). Branching from the root there are several other
directories called bin, lib, user, etc, temp and dev. The root directory also
contains a file called LINUX which is LINUX kernel itself. These directories
are called sub- directories, their parent being the root directory. Each of
these sub-directories contains several files and directories called sub- sub-
directories.
LINUX basic commands:
|
Command Description
|
|
Example
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
ls
|
|
|
|
List
information about file(s)
|
|
$ ls
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
date
|
|
|
|
Display
or change the date & time
|
|
$ date
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
cal
|
|
|
|
|
Display a calendar
|
|
$ cal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
pwd
|
|
|
|
Print Working Directory
|
|
$ pwd
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
uname
|
|
|
|
Print
system information
|
|
$ uname
|
|
||
|
|
|
|
|
|
|
|
|
||
|
clear
|
|
|
|
Clear
terminal screen
|
|
$ clear
|
|
||
|
|
|
|
|
|
|
|
|
||
|
man
|
|
|
|
Help
manual
|
|
$ man gedit
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ cd directoryname – into
|
|
|
cd
|
|
|
|
Change
working directory
|
|
directory
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ cd .. – out
of directory
|
|
|
|
|
|
|
|
|
|
|
||
|
mkdir
|
|
|
|
Create
new folder(s)
|
|
$ mkdir newfolder
|
|
||
|
|
|
|
|
|
|
|
|
||
|
rmdir
|
|
|
|
Remove
folder(s)
|
|
$ rmdir unwantedfolder
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
cp
|
|
|
|
Copy one
or more files
to another
|
|
$ cp sourcefile newfile
|
|
||
|
|
|
|
location
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
rm
|
|
|
|
Remove
files
|
|
$ rm unwanted file
|
|
||
|
|
|
|
|
|
|
|
|
||
|
ps
|
|
|
|
Process
status
|
|
$ ps
|
|
||
|
|
|
|
|
|
|
|
|
||
|
who
|
|
|
|
Print all usernames currently logged in
|
|
$ who
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
whoami
|
|
|
|
Print the
current user id and name (`id -
|
|
$ whoami
|
|
||
|
|
|
|
un')
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
adduser
|
|
|
|
Add a
new user
|
|
$ sudo adduser student
|
|
||
|
|
|
|
|
|
|
|
|
||
|
useradd
|
|
|
|
Create
new user account
|
|
$ sudo useradd user1
|
|
||
|
|
|
|
|
|
|
|
|
||
|
expr
|
|
|
|
Evaluate
expressions
|
|
$ expr c = $ (( $a + $b ))
|
|
||
|
|
|
|
|
|
|
|
|
||
|
echo
|
|
|
|
Display
message on screen
|
|
$ echo “ HELLO ”
|
|
||
|
|
|
|
|
|
|
|
|
||
|
read
|
|
|
|
To get
input from keboard
|
|
$ read a
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$
mount -t type
device
|
|
|
mount
|
|
|
|
Mount a
file system
|
|
destination_dir
|
|
||
|
|
|
|
|
|
|
|
|
$ mount /dev/fd0 /mnt/floppy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
umount
|
|
|
|
Unmount
a device
|
|
$ umount [options] filesystem
|
|
||
|
|
|
|
|
$ umount /dir1
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chmod
|
|
|
|
Change the
access permissions of files
|
|
$ chmod 755 hello.c
|
|
||
|
|
|
|
and
directories
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
man
|
|
|
|
read
man pages on command
|
|
$man pwd
|
|
||
|
|
|
|
|
|
|
|
|
||
|
info
|
|
|
|
read
Info pages on command
|
|
$info ls
|
|
||
|
|
|
|
|
|
|
|
|
|
|