Laboratory Lecture 1
Laboratory Lecture 1
Laboratory Lecture 1
(CPET 529)
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.
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
mv
This command is used to move the file or
directory
Example:
rm
This command is used to remove or delete
files and directories.
Example: