Understanding GNU/Linux
Understanding GNU/Linux
Why GNU/Linux not Linux? What is GNU?
What is a GNU/Linux distribution?
GNU/Linux architecture – kernel, shell,
applications
Where you can install GNU/Linux?
Where we can find software for GNU/Linux?
Where is GNU/Linux documentation?
man
/usr/share/doc/*
Understanding GNU/Linux
GNU/Linux concepts
Everything is GNU/Linux is a file
Case sensitive
CLI is your ultimate weapon
Best practices
Don't use space character as a word seperator for
files. Use '_' instead.
Don't spoil GNU/Linux directory structure
CLI – Command Line Interface
$
#
ls
tail
head
rm
mkdir
You have been given a text file having a list of
10 directory names to be created. Suggest a
solution?
for name in `cat abc.txt`; do mkdir $name; done
CLI – Command Line Interface
mv
cp
find
>
>>
|
Partition Geometry
fdisk – Partition table reader and manipulator
mount – Disk mount information and
management
df – Filesystem disk space usage
du – File space usages estimator
fstab – Partition mount instructions
GNU/Linux Directory Structure
Why need partitions?
/var – This is where the variable data goes
such as mail files, log files, database files, etc.
What happens, if for some reason, a log file
grows exponentially and eat up all the available
disk space?
/tmp – This is where all the temporary data files
stored by applications. Obviously, this place is
accessible for every user. What happens if a
malicious user run a bad script to fill up the
whole /tmp and you don't have a separate /tmp
partition?
Why need partitions?
/home – This is where the users home
directories goes. What if a user fills up his own
home directory with the intention of doing an
DoS attack? It is just a matter of running a
simple script. For example:
#!/bin/bash
man ls > $(mktemp)
$0
Using fstab to impose restrictions
auto/noauto
dev/nodev
exec/noexec
ro/rw
acl
quota
Mounting a partiton read-only:
mount -o remount, ro <mount point>
Introduction to 'vim'
Creat a file
Editing a file
Saving a file
Navigating a file
Syntax highlighting
Copying content within a file
Deleting content within a file
Opening multiple files
Searching a file
User and Group Management
/etc/passwd
/etc/group
/etc/shadow
/etc/sudoers
Format: usernames/group servername =
(usernames command can be run as) command
How to add a user?
How to add a group?
How to change passwords?
Finding useful user information
whoami
who
last, last <user>
groups
lsof -u
Shell command history
Process identification and review
ps -aux
pstree
ps -u <username>
ps -ef |grep <process name>
ps -u <username>
Use the man page and -o parameter with its
valuse to generate process information
/proc