Use and Study of Linux Gui and Commands: Assignment No.1 AUGUST 3, 2015
Use and Study of Linux Gui and Commands: Assignment No.1 AUGUST 3, 2015
1
AUGUST 3, 2015
F.E
ASSIGNMENT NO: 1
COMPILED BY: - CHANDAN PRASAD
AIM: Use and Study of LINUX GUI and Commands.
OBJECTIVE: To learn how to use Linux GUI and Commands.
THEORY:
LINUX
Linux is one of popular version of UNIX operating System. It is open source as its source code
is freely available. It is free to use. Linux was designed considering UNIX compatibility. Its
functionality list is quite similar to that of UNIX.
COMPONENTS OF LINUX SYSTEM
Linux Operating System has primarily three components:
Kernel - Kernel is the core part of Linux. It is responsible for all major activities of this
operating system. It is consists of various modules and it interacts directly with the
underlying hardware. Kernel provides the required abstraction to hide low level hardware
details to system or application programs.
System Library - System libraries are special functions or programs using which
application programs or system utilities accesses Kernel's features. These libraries
implements most of the functionalities of the operating system and do not requires kernel
module's code access rights.
8/3/2015
ASSIGNMENT NO: 1
space and do not require any context switch and hence is very efficient and fast. Kernel runs each
processes and provides system services to processes, provides protected access to hardwares to
processes.
Support code which is not required to run in kernel mode is in System Library. User programs
and other system programs works in User Mode which has no access to system hardwares and
kernel code. User programs/ utilities use System libraries to access Kernel functions to get
system's low level tasks.
BASIC FEATURES
Following are some of the important features of Linux Operating System.
Open Source - Linux source code is freely available and it is community based
development project. Multiple teams works in collaboration to enhance the
capability of Linux operating system and it is continuously evolving.
Multi-User - Linux is a multiuser system means multiple users can access system
resources like memory/ ram/ application programs at same time.
Hierarchical File System - Linux provides a standard file structure in which system
files/ user files are arranged.
Shell - Linux provides a special interpreter program which can be used to execute
commands of the operating system. It can be used to do various types of operations,
call application programs etc.
Security - Linux provides user security using authentication features like password
protection/ controlled access to specific files/ encryption of data.
Architecture
8/3/2015
ASSIGNMENT NO: 1
Hardware layer - Hardware consists of all peripheral devices (RAM/ HDD/ CPU
etc.)
cat - A Unix/Linux command that can read, modify or concatenate text files,
most commonly used for displaying contents of files.
cat /etc/motd
This command will display the contents of the motd
cat > newfile
some notes I want to save in newfile.
CTRL-D
This creates a new file (named newfile). You type as much text as you wish, then type ctrl-D to
save the file.
root@SDR:/home/sunil# cat > chandan.c
Hi friends kindly press Ctrl+D to save
root@SDR:/home/sunil# ls -l
total 52
drwxr-xr-x 2 root root 4096 Aug 6 14:35 chandan
-rw-r--r-- 1 root root
8/3/2015
ASSIGNMENT NO: 1
cd - The cd command changes the current directory in Linux, and can toggle
between directories conveniently. It is similar to the CD and CHDIR commands
in MS-DOS.
cd [directory]
root@SDR:/home/sunil# cd chandan
root@SDR:/home/sunil/chandan# ls
chandan.c
root@SDR:/home/sunil/chandan# cd ..
root@SDR:/home/sunil#
chmod - chmod changes the access mode (permissions) of one or more files.
Only the owner of a file or a privileged user may change the mode.
Instead of using alphabets u, g, o for user, group, and others we can use numbers to specify file
permissions:
rwx
111
=7
rw-
110
=6
r-x
101
=5
r--
100
=4
-wx
011
=3
-w-
010
=2
--x
001
=1
--=
000
Command:
=0
-rw-rw-r--
-rw-rw-r--
-rw-r--r--
8/3/2015
ASSIGNMENT NO: 1
drwxrwxr-x
-rw-r-----
-rwxr-xr-x
-rwxr-xr-x archive.sh
Command:
After:
-rwxr-xr-- archive.sh
-rw-r--r--
publicity.html
Command:
After:
-rw-rw-rw- publicity.html
cp - The cp command copies files and directories, and copies can be made
simultaneously to another directory if the copy is under a different name.
cp sourcefile targetfile
root@SDR:/home/sunil# cp chandan.c chandan
root@SDR:/home/sunil# cd chandan
root@SDR:/home/sunil/chandan# ls
chandan.c
date - Date sets a system's date and time. Also a useful way to output/print
current information when working in a script file.
root@SDR:/home/sunil# date
Thu Aug 6 14:45:19 IST 2015
Set Date and Time using set option: You can set date and time of your system using -s or
set option as shown below...
root@SDR:/home/sunil# date
Mon August 03 22:02:24 IST 2015
root@SDR:/home/sunil# date -s "Sun August 03 21:00:00 IST 2015"
Sun August 03 21:00:00 PDT 2015
root@SDR:/home/sunil# date
Sun August 03 21:00:00 IST 2015
8/3/2015
ASSIGNMENT NO: 1
exit - The exit command terminates a script, and can return a value to the
parent script.
ls - The ls command lists files and directories within the current working
directory, and admins can determine when configuration files were last
edited.
sdr@SDR:~$ ls
1.txt access.c~ bar
chmod.c~ Downloads
file1 lnknewf newdir Pictures stat.c
Templates umask.c~ acc
a.out
chmod Desktop Music newf Public stat.c~
umask
Videos access.c chmod.c Documents examples.desktop
ls l -displays a long listing of the files.
sdr@SDR:~$ ls -l
total 60
-rw-rw-r--
1 sdr sdr
-rwxrwxr-x
-rw-rw-r--
-rw-rw-r--
-rwxrwxr-x
-rw-------
-rw-r--r--
1 sdr sdr
-rwxr-x---
-rw-------
In this long listing, the first character isd or '-'. It distinguishes between file types. The entries
with a '-' (dash) are regular files, and ones withd are directories. Next 9 characters are
permissions ('rwxr-xr-x' in first listing). The number following the permissions is link count.
Link count follows user and group owner. In above example, the file owner is sdr and group
owner sdr as well. Next is the size of file. And then time stamp before the name of file (or
directory).
sdr@SDR:~$ ls -ls
total 60
4 -rw-rw-r-- 1 sdr sdr
12 -rwxrwxr-x
8/3/2015
ASSIGNMENT NO: 1
1 sdr sdr
8/3/2015
ASSIGNMENT NO: 1
-rw-rw-r--
-rw-r--r--
1 sdr sdr
-rw-------
-rw-r--r--
-rw-r--r--
-rw-------
man - Short for "manual," man allows a user to format and display the user
manual built into Linux distributions, which documents commands and other
aspects of the system.
mkdir directoryname
root@SDR:/home/sunil# mkdir chandan
root@SDR:/home/sunil# ls -l
total 48
drwxr-xr-x 2 root root 4096 Aug 6 14:35 chandan
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Desktop
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Documents
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Downloads
-rw-r--r-- 1 sunil sunil 8980 Aug 5 11:31 examples.desktop
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Music
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Pictures
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Public
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Templates
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Videos
mv sourcefile targetfile
root@SDR:/home/sunil# mkdir Tempdir // this is an example of Make Directory
8/3/2015
ASSIGNMENT NO: 1
root@SDR:/home/sunil# ls -l
total 56
drwxr-xr-x 2 root root 4096 Aug 6 14:40 chandan
-rw-r--r-- 1 root root
pwd - The pwd (print working directory) command displays the name of the
current working directory. A basic Linux command.
root@SDR:/home/sunil# pwd
/home/sunil
root@SDR:/home/sunil# ps
PID TTY
TIME CMD
2543 pts/0
00:00:00 su
2546 pts/0
00:00:00 bash
2629 pts/0
00:00:00 ps
rmdir directoryname
root@SDR:/home/sunil# rmdir chandan
8/3/2015
ASSIGNMENT NO: 1
shutdown - Shutdown is a command that turns off the computer and can be
combined with variables such as -h for halt after shutdown or -r for reboot after
shutdown.
su [username]
sdr@SDR:/home/sunil$ su //SuperUser Login
Password:
root@SDR:/home/sunil# ls -l
total 44
drwxr-xr-x 2 sunil sunil 4096 Aug 5 11:33 Desktop
8/3/2015
ASSIGNMENT NO: 1
10
sudo - Sudo allows a system admin to give certain users the ability to run some
(or all) commands at the root level, and logs all commands and arguments.
tty Print the file name of the terminal connected to standard input.
root@SDR:/home/sunil# tty
/dev/pts/0
whoami - whoami prints or writes the user/login name associated with the
current user ID to the standard output.
root@SDR:/home/sunil# who
sdr
:0
sdr
pts/0
root@SDR:/home/sunil# whoami
root
root@SDR:/home/sunil# who am i
sdr
pts/0
root@SDR:/home/sunil# wc /etc/passwd
35 57 1698 /etc/passwd
The /etc/passwd file has 35 lines, 57 words, and 1698 letters present in it.
8/3/2015
ASSIGNMENT NO: 1
11
8/3/2015
ASSIGNMENT NO: 1
12