Laboratory Lecture 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Operating System

(CPET 529)

Professor: Michael C. Olivo


Linux Command Usage
List of all Directories in Linux
 / ---------> Root or the main directory
|---root ---------> Home directory for the root user
|---home ---------> User's home directories
| |----ftp ---------> Users services are listed here
| |----httpd
| |----samba
| |----user1
| |----user2
|---bin ---------> Commands needed during bootup and also needed by normal
users
|---sbin ---------> Like bin but commands are not intended for normal users.
|---proc ---------> This filesystem is not on a disk. virtual directory.
| |
| |----n ---------> A directory with info about process number n.
|
|---usr ---------> Contains all commands, libraries, man pages etc for normal
operation.
| |
| |----bin ---------> Almost all user commands.
| |----sbin ---------> System admin commands not needed in the root file
system.
| |
| |----include ---------> Header files for the C programming language.
 | |
| |----lib ---------> Unchanging data files for programs and subsystems
| |----local ---------> Locally installed software and other files.
| |----man --------> Help pages
| |----info ---------> Info documents
| |----doc ---------> Documentation for various packages
| |----tmp
| |----X11R6 ---------> The X windows system files.
| |
| |----X386 ---------> Like X11R6 but for X11 release 5
|---boot --------> Files used by the bootstrap loader, LILO. Kernel images stored.
|---lib ---------> Shared libraries needed by the programs on the root filesystem
| |----modules --------- Loadable kernel modules.
|
|---dev ---------> Device files for devices such as disk drives, serial ports, etc.
|---etc ---------> Configuration files specific to the machine.
| |----skel ---------> For home directory creation.
| |----sysconfig ---------> Files that configure the linux system for networking etc.
|---var ---------> Contains files that change for mail, news, temp files, etc
| |----file
| |----lib ---------> Files that change while the system is running normally
| |----local ---------> Variable data for programs installed in /usr/local.
| |----lock ---------> Lock files. Used by a program.
| |----log ---------> Log files from programs such as login and syslog etc.
| |
| |----run ---------> Files that contain information about the system.
| |
| |----spool ---------> Directories for mail, printer spools, news and other spooled
work.
| |----tmp ---------> Temporary files that are needed to exist for longer time.
| |
|---mnt ---------> Mount points for temporary mounts by the system administrator.
Linux Basic Commands
 Linux operating system has a beautiful graphical interface
which most of us will be using. It will be good to learn the
basic commands in Linux to work interactively with the
Linux operating system.

 Linux has a back end access know as shell. You can control
and activate all the process in Linux from the shell. So it is
very important to learn few basic commands to work with
Linux operating system.

 There are 7 terminals for Linux. 6 terminals are non - GUI


and 1 terminal for GUI access. You can login to each
terminal using Alt + Ctrl + F1 , F2, .. F7

*Note: user denotes the username.


Navigation Commands - [ pwd, cd ]
 pwd
This command is used to find the current location or current
working directory.
 Eg:
[olivo@localhost -]$ pwd
/home/user
 cd
This command id used to change the directory. You can move
from one directory to another using this command.
 Example 1:
Your current working directory is /home/user. You want to
change your current working directory from /home/user to
/home/user/Desktop, use the following command

[olivo@localhost -]$ cd Desktop


[olivo@localhost Desktop]$ pwd
Navigation Commands - [ pwd, cd ]
 Example 2:
If you want to move back to /home/user, use the following
command
[olivo@localhost Desktop]$ cd ..
[olivo@localhost - ]$pwd
/home/olivo
 Example 3:
To get back to the home directory of the user
[olivo@localhost - ]$cd -
[olivo@localhost - ]$pwd
/home/olivo
 Example 4:
If you want to go to the root directory of the user
[olivo@localhost - ]$cd /
[olivo@localhost - ]$pwd
Listing contents in a directory
[ ls, ls -l, ls -a]

 ls
This command is used to list all the files and
directory in the current directory.
 Example 1

[olivo@localhost - ]$ls
bin chgroup etc Lib media null
proc sbin srv var Boot dev home
Lost+found mnt opt root seLinux sys
usr
Listing contents in a directory
[ ls, ls -l, ls -a]

 Example 2
[olivo@localhost - ]$ls –a
 The -a option tells the ls command to report information
about all files, including hidden files.
 Example 3
ls -l
This command is also used to list all the files and directories.
Here you will get more details about the files and directories
present in the current directory. You will see the permission
set, creation date, file / directory size.
 Eg:
[olivo@localhost - ]$ls – l
total 98
dr-xr-xr--x 2 root root 4096 Nov 6 02:56 bin
dr-xr-xr--x 5 root root 1024 Nov 6 10:23 boot
Manipulating files
[ mkdir, cp, mv, rm ]

 mkdir
This command is used to create a new directory
 Example: Create a directory name MIKE in

/home/user
[olivo@localhost - ]$ls
[olivo@localhost - ]$cd /home/olivo
[olivo@localhost - ]$mkdir MIKE
[olivo@localhost - ]$ls
 This will create a new directory name MIKE
Manipulating files
[ mkdir, cp, mv, rm ]

 cp
This command is used to copy files/directory.
 Example 1

[olivo@localhost -]$ cd /
[olivo@localhost -]$ls
[olivo@localhost -]$cd etc
[olivo@localhost -]$ls
[olivo@localhost etc]$cp mail.rc /home/olivo/MIKE
This will copy the file1 into the directory MIKE
Manipulating files
[ mkdir, cp, mv, rm ]

 Example 2
[olivo@localhost etc]$cp *.conf /home/olivo/MIKE
This will copy the all files with an extension name
of conf into the directory MIKE
 Example 3

[olivo@localhost etc]$cp *.* /home/olivo/MIKE


This will copy the all files into the directory MIKE
Manipulating files
[ mkdir, cp, mv, rm ]

 mv
This command is used to move the file or
directory
 Example:

[olivo@localhost -]$mv directory2 directory1


This will move the whole directory2 into
directory1
 [olivo@localhost -]$mv MIKE Desktop
Manipulating files
[ mkdir, cp, mv, rm ]

 rm
This command is used to remove or delete
files and directories.
 Example:

[olivo@localhost MIKE]$ rm *.conf


This will delete the all files with an extension
of conf
 [olivo@localhost -]$ rmdir MIKE

This will delete the directory MIKE


Activity
1. Create three directory in Desktop namely
Ubuntu, Fedora, Caldera
2. Copy all files from etc directory to Ubuntu
3. Copy all extension of .conf to from etc directory
to Caldera directory
4. Rename any 2 files with an extension of .conf to
Caldera directory
5. Delete the directory of Fedora

You might also like