SDP Basic Ubuntu
SDP Basic Ubuntu
SDP Basic Ubuntu
Basic Commands
Ms. Roopal Mamtora
(Asst. Prof. CE Dept)
Installing Ubuntu
19-06-2017 2
Second Half
Basic Commands
19-06-2017 3
Ubuntu Vs. Windows
Linux is developed by Open Source Development whereas
Windows is developed by Microsoft.
19-06-2017 4
Ubuntu Vs. Windows
Ubuntu has built-in security
19-06-2017 5
Ubuntu
Linux is a Operating System.
19-06-2017 6
Ubuntu
Linux comes in many varieties/versions
which are called distributions :
Ubuntu
Fedora
Mint
Debian
19-06-2017 9
Understanding Ubuntu Structure
/bin: for terminal commands,like ls,mount,rm,etc.
/boot : files required to boot (such as the kernel, etc)
/dev : your devices (everything from drives to displays)
/etc : just about every configuration file for your system.
/home : locally stored user files and folders
/lib : system libraries
/media : intended as a mount point for external devices,
such as hard drives or removable media (floppies, CDs,
DVDs).
/mnt :dedicated specifically to "temporarily mounted"
devices, such as network filesystems.
19-06-2017 10
Understanding Ubuntu Structure
/opt :can be used to store additional software for your system
/root :is the superuser's home directory
/sbin :contains important administrative commands that should
generally only be employed by the superuser.
/srv :for data directories of services such as HTTP (/srv/www/) or
FTP.
/tmp :for temporary files used by applications.
/usr :contains of user utilities and applications, and partly replicates
the root directory structure e.g: /usr/bin & /usr/lib.
/var : mainly logs, databases, etc.
it contains a notable directory : /var/log where system log files are kept
19-06-2017 11
Installing Ubuntu
Go to the boot option by pressing F12.
Set the systemname & password which will be used during loggin.
19-06-2017 12
Installing additional packages
Install the acl(access control link)
package:
19-06-2017 13
MBR & different boot loaders
BIOS needs someplace where it can load the initial boot program
that starts the process of loading the operating system.
The place where this information is stored is called the master boot
record (MBR), also referred to as the master boot sector or even
just the boot sector .
This is the consistent starting point that the disk will always use.
When a computer starts and the BIOS boots the machine, it will
always look at this first sector for instructions and information on
how to proceed with the boot process and load the operating
system.
19-06-2017 14
Boot Process
Pressing the power button Login screen
19-06-2017 15
Boot Process
BIOS(Basic Input/Output System):
Performs some system integrity checks
Searches(floppy/cd-rom/hard drive), loads(memory),
and executes the boot loader program loads and
executes the MBR boot loader.
19-06-2017 16
Boot Process
GRUB(Grand Unified Bootloader):
loads the default kernel image as specified in the
configuration fileloads and executes Kernel and
initrd(Initial RAM Disk) images.
Kernel:
Mounts the root file system as specified in the “root=” in
grub.conf
Kernel executes the /sbin/init program
initrd is used by kernel as temporary root file system
untill the real file system is up.
19-06-2017 17
Boot Process
Init:
Looks at the /etc/inittab file to decide the Linux
run level.
Following are the available run levels
0 – halt
1 – Single user mode
4 – unused
5 – X11 (default)
6 – reboot
19-06-2017 18
Boot Process
Runlevel program:
Depending on your default init level setting, the system
will execute the programs from one of the following
directories.
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/
Under the /etc/rc.d/rc*.d/ directories, you would see
programs that start with S-startup(used during startup)
and K-kill(used during shutdown).
19-06-2017 19
Basic Commands
Sudo:SuperUserDo
It is used before each command that requires root permissions
$ sudo su
ls (list):
shows all the files and folders of the directory that you're working in.
ls [-l/-a/-R]
-l:List file with permission
-a:list with hidden files
-R:List directories , sub directories
man (manual):
used to display helpful information about commands
Man [-k]
-k : search by command description rather than command name
$ man cp
19-06-2017 20
Basic Commands
cd (Changing directory):
type the name of the folder you want to go in from your current
directory
to go up the hierarchy just do it by giving double dots (..) as
the parameter.
/home $ cd usr /home/usr $
cd .. -->To a directory one level up (parent directory)
cd - -->To your previous working directory
cd / -->To the / (root) directory
apt-get :
This command differs distro-by-distro.
In Debian based Linux distributions, to install, remove and
upgrade any package we've Advanced Packaging Tool (APT)
package manager .
Fedora used to have yum but now it has dnf.
$sudo apt-get update
$ sudo dnf update
19-06-2017 23
Basic Commands
grep:
to help finding the file based on given keywords.
$ grep user /etc/passwd
Cat:
View the text inside the file ($ cat file1 )
Create a file ($ cat > file1 )
Append text to a file ($ cat >> file1 )
19-06-2017 25
Basic Commands (File Permission)
For example ,if we want to give the following permissions to a file:
19-06-2017 26
Basic Commands (File Permission)
One can also remove certain permissions:
Remove group read permission of a file
$ chmod g-r filename
19-06-2017 27
Basic Commands (File Permission)
19-06-2017 28
Basic Commands (File Permission)
Sticky Bits:
The sticky bit applies only to directories, and is typically
used on publicly-writeable directories.
To add or remove the sticky bit, use chmod with the "t"
flag:
chmod +t <directory>
chmod -t <directory>
19-06-2017 29
Basic Commands (File Permission)
Making a public directory
$ mkdir folder
$ chmod 777 folder
$ ls -l
Output :
total 3
drwxrwxrwx 2 user user ….
Adding the sticky bit (note the "t" in the other execute field):
$ chmod +t folder
ls -l
Output :
total 3
drwxrwxrwt 2 user user ….
19-06-2017 30
Basic Commands (Vi editor)
Vi is a powerful text editor
Insert mode
allows you to insert text in Vi.
press the i key to enter the insert mode
press the escape key to return to command mode.
19-06-2017 31
Basic Commands (Vi editor)
Saving & quitting:
You can save and quit vi from command mode.
Type :wq and press enter to write the file to disk and quit vi
type :w and press enter to write the file to disk without quitting
Vi won’t let you quit if you’ve modified the file since you last
saved, but you can type :q! and press enter to ignore this
warning.
19-06-2017 32
References
https://askubuntu.com/questions/37198/why-arent-viruses-an-issue
https://citricks.net/introduction-ubuntu-server-cli/
https://freedompenguin.com/wp-content/uploads/2015/10/linux-filesy
stem.png
https://help.ubuntu.com/community/LinuxFilesystemTreeOverview
http://www.ubuntugeek.com/linux-or-ubuntu-directory-structure.html
http://www.linuxandubuntu.com/home/10-basic-linux-commands-tha
t-every-linux-newbies-should-remember
http://www.thegeekstuff.com/2011/02/linux-boot-process
19-06-2017 33