
Why to learn and use Linux?
No one can afford to ignore Linux. The acceptance of Linux as a robust and dependable operating system is growing day by day. Big corporations, small business houses, govt. departments, colleges and universities are moving to Linux as their choice platform.
This course covers basics and as well as some advance Linux concepts. The focus is to make your Linux fundamentals very strong and use of Linux command line very easy.
How to switch between the GUI (Graphical User Interface) and CLI (Command-Line Interface / TTY) when using Ubuntu 24.04 Desktop.
How to automatically boot into CLI Mode instead of GUI in Ubuntu 24.04?
How to revert back to default GUI boot mode?
How to start using Linux? How to install additional packages? How to create additional user? How to run some basic Linux commands. The purpose of this lecture is to make you comfortable in using Linux?
How to work as root user by using "sudo". The difference between "sudo -i" and "sudo -s".
How to create files and directories in Linux? How to list files and directories? How to append data to file? How to remove files? How to remove directories?
How to view and change system date? How to use wc, cal and pwd commands? How to use more and less commands? How to declare variables? How to view value contained in variable?
What are the seven different methods to access files? Why some people consider Linux difficult to use? What is the right approach for learning Linux?
Understand home directory. Can normal user create files outside home directory?
How to redirect output in Linux? Which redirection symbol (“>”, “I”) to use?
Understand Linux directory structure. How to Navigate between directories? How to View directory structure?
Why we need aliases? How to create aliases? How to remove aliases?
How to remove files and directories? What are the different options that can be used when removing files and directories?
How to copy files and directories? What are the different options that can be used when copying files and directories?
How to move and rename files and directories? What are the different options that can be used when moving and renaming files and directories?
How to use wild cards in Linux? What are different wildcards available?
How to use brace {} expansion in Linux?
How to use compression utilities gzip, bzip2 and zip? How to decompress using gunzip and bunzip2? How to use unzip?
How to use tar for backup and restore? How to use tar with gzip and bzip2? How to use tar with gunzip and bunzip2? How to take backup of all users? How to take backup at logout?
How to set local and global variables? How to view and use local/global variables?
How to use in-built help in Linux? How to use "man" and "info" commands? How to use "whatis", "/usr/share/doc" and "--help".
How to use "df" and "du"?
How to manage input (stdin), output (stdout) and error (stderr) streams in Linux? How to capture input, output and error messages?
How to use bash completion feature in Linux?
What do you mean by hard links, soft links and inodes? Understand "mv" and inode relationship. Understand "cp" and inode relationship. How to create and view hard link? How to create and view soft link?
What is the use of PATH variable? How to use PATH variable in Linux?
How to use Linux history?
What is default shell? How to change shell as normal and root user?
How to change prompt?
The followings scripts can be read by users depending upon whether the user is root/normal user and whether the shell is login/non-login.
1 /home/{username}/.profile
2 /home/{username}/.bashrc
3 /etc/profile
4 /etc/bash.bashrc
5 scripts in “/etc/profile.d/” directory
How to use critical files?
1 /home/{username}/.profile
2 /home/{username}/.bashrc
3 /etc/profile
4 /etc/bash.bashrc
5 scripts in “/etc/profile.d/” directory
How to use critical files?
1 /home/{username}/.profile
2 /home/{username}/.bashrc
3 /etc/profile
4 /etc/bash.bashrc
5 scripts in “/etc/profile.d/” directory
How to use .bash_logout file?
How to use mount and umount? How to access USB/pen drives in Linux?
When ever we are creating files/directories in Linux, default permissions should be “666” for files and “777” for directories. But that is too much openness. The “umask” is used to reduce/subtract/withhold the permissions. The effective permissions can be obtained by deducting umask from default permissions.
The advantage of using umask is that you can control permissions of your newly created files and directories. Otherwise the files/directories will be created with certain permissions, then you have to use “chmod” to change the permissions.
Understand user permissions.
Understand read, write, execute permissions on files. We will discuss the following scenarios:
What will happen, if there are "no permissions" on files?
What will happen, if there is "only read(r) permission" on files?
What will happen, if there is "only write(w) permission" on files?
What will happen, if there is "only execute(x) permission" on files?
Understand read, write, execute permissions on files. We will discuss the following scenarios:
What will happen, if there are "read(r), execute(x) permissions" on files?
What will happen, if there are "read(r), write(w) permissions" on files?
What will happen, if there are "read(r), write(w), execute(x) permissions" on files?
Understand read, write, execute permissions on directory. We will discuss the following scenarios:
What will happen, if there are "no permissions" on directory?
What will happen, if there is "only read(r) permission" on directory?
What will happen, if there is "only write(w) permission" on directory?
What will happen, if there is "only execute(x) permission" on directory?
Understand read, write, execute permissions on directory. We will discuss the following scenarios:
What will happen, if there are "read(r), write(w) permissions" on directory?
What will happen, if there are "read(r), execute(x) permissions" on directory?
What will happen, if there are "read(r), write(w), execute(x) permissions" on directory?
Why we need to change permissions in Linux? How to change permissions in Linux?
Symbolic vs numeric permissions.
Till now, we have used the symbolic method to change file permissions. Another method is the octal (numeric) method, which generally uses a three-digit number.
•The first digit represents user (owner) permissions.
•The second digit represents group permissions.
•The third digit represents others (world) permissions.
•Permissions are assigned based on the sum of the following values:
•
•Read (r) = 4
•Write (w) = 2
•Execute (x) = 1
We want to give all permissions “rwx” to user(u), group(g), others(o) on “file2”, the numeric equivalent will be first digit(4+2+1=7), second(4+2+1=7), third(4+2+1=7), ie 777.
Why the need for group permissions? How to use group permissions?
How to use chown, chgrp and chmod?
How to make file and directories irremovable even for “root”, how to make files append able only, how to make that there is no change in access time thus saving on disk i/o operations? The answer lies in using “chattr”.
How to use vi/vim editor? How to use various options in vim editor?
How to use vi/vim editor? How to use various options in vim editor?
How to use nano editor? How to use various options in nano editor?
When we add the user it writes the information into 4 files. We will be discussing first 2 files in detail. First 2 files are the mostly used with the last two rarely.
passwd
shadow
group
gshadow
How to add users? How to modify user settings? How to delete users?
What is the difference between using adduser and useradd.
If your system is required to be managed by many people or if you want to delegate certain tasks to one user (ie creating users), others tasks to someone else (disk management using fdisk) and so on, then “sudo” is of great help.
Other option could have been to give “root password” to other administrators, but not recommended. The sudo allows a permitted user to run a command as superuser or as another user as specified in “/etc/sudoers” file.
The sudo requires you to authenticate with password of “yourself”, not that of “root”, which is very important. Once authenticated, it will not ask for the password for next 5 minutes (which we can reset) for executing other commands. Moreover, whatever we are executing or trying to execute will get logged in “/var/log/auth.log” file.
How to use sudo? How to give permissions to user using sudo? How to test permissions given to user?
Suppose we are giving instructions to new Linux user "vipin" that please do the following things after logging in
- create 2 directories "test1" and "test2"
- enter into directory "test1"
- redirect the output of "who" command to "file1"
- append the output of "date" command to "file1"
- create 2 more directories "songs" and "movies"
The new user may get confused. So, what is the solution? The solution is to write a script that will have all the instructions in a file and run that script under bash shell.
cat >script1
mkdir test1 test2
cd test1
who >file1
date >>file1
mkdir songs movies
How to run shell script? Understand shell scripting concepts?
./script1
(Run the script. You will get permission denied error)
ls -l script1
(Check the permissions)
chmod +x script1
(Make the script executable for all users)
ls -l script1
(Check the permissions)
./script1
(Run the script)
ls -l
(Verify whether script was able to create directories and files or not)
Since we are running the script under bash shell, so this is called bash scripting or shell scripting.
So scripting is nothing but a set of instructions. these scripts can be used for administration purposes, to perform certain common day to day tasks.
It is always better to start the bash shell script with shebang (#!) and complete line should be written as
#! /bin/bash
(Where “shebang” (#!) denotes that file is a script. “/bin/bash” indicates the interpreter in this case is “bash” shell)
Since # character in Linux denotes comment line, so the whole line as such will be treated as comment but it will give useful information to your operating system to run this script using the specified interpreter.
The syntax is “#! /path/to/interpreter”. The various possibilities with “shebang” are:
#! /bin/sh execute using bourne shell
#! /bin/csh execute using c shell
#! /bin/bash execute using bourne again shell
#! /usr/bin/python execute using python
#! /usr/bin/perlexecute using perl
Create a script “script2” for performing the following tasks.
- display who is logged in.
- date and time of system
- current working directory
- display the calendar of feb 2028
Create scripts which will check for file type.
Create script which will check whether file is executable or not and if the file is not executable, make it executable.
Create a script using “multiple if statements” for determining “rank” of the student based on marks.
Create a script using “switch case” for displaying a menu, accepting the choice and performing the task according to choice.
Create a script using “for loop” for copying the files one by one to “test1” directory.
Describe positional parameters.
You can pass maximum 9 parameters as arguments to a program. If you want to specify more than 9 arguments, then you have to use “shift”.
1st argument is stored in $1, 2nd in $2 and so on.
How can you determine whether the previous executed command was successful or not. This can be determined by checking the value of “$?” variable.
If the value is “0” that means command was executed successfully. If the value is between 1 to 255 that means some error occurred. These values are called exit code. You can also set the exit code.
Write a script which uses the $? variable. The script should be able to ping many systems at a time and determine which systems are in networking and which are not
How to use || (or) and && (and) operators.
Explain test conditions along with "-eq" and "="
Create a simple function which will create directory and then automatically takes you to that directory.
Show the usage of “do .... while” and “until” loop.
In this we have declared the variable “n=5” and by using while condition we have specified that go on executing the instructions till the value of "n" is greater that "0" then we will use the decrement operator (--) to decrease the value of n by 1 each time. The operator (++) can be used to increment the value by 1.
Instead of using “do while”, how can we use “until” conditional loop.
How to perform arithmetic operations on variables.
There are 2 ways of doing this. One by using "expr" and other by using "echo
Create a function that will find the maximum value from the supplied values.
Create the script to print the table of a number.
Create the script to find odd or even number.
Write a script for swapping of numbers.
No one can afford to ignore Linux. The acceptance of Linux as a robust and dependable system is growing day by day. Big corporations, small business houses, government departments, colleges and universities are moving to Linux as their choice platform. Linux is future. It is the most flexible and open ended operating system (OS).
What will you learn?
Linux command line introduction
How to create files and directories?
What is home directory?
Understand home directory.
Understand Linux directory structure
How to create and use aliases?
How to remove/copy/rename files and directories?
How to use in-built help?
Wild cards (*, ?, [ ])
vi (vim) and nano editor
How to use and manage history?
How to change shell?
How to use soft link, hard link and inodes?
Introduction to Linux permissions
User management in Linux.
Why and how to use sudo?
How to delegate tasks using sudo?
What is login and non-login shell?
Critical files in Linux and their use cases.
How to compress using gzip, bzip2?
How to use gunzip, bunzip2, zip and unzip?
Use tar for backup and restore.
How to use tar with gzip,bzip2,gunzip,bunzip2?
Local and global variables in Linux. How to create and use variables?
How to access CD/DVD/USB drives in Linux?
How to manage input(stdin), output(stdout) and error(stderr) streams in Linux?
Understand read(r), write(w) and execute(x) permissions in Linux
How to use user permissions?
Why and how to use group permissions?
What is umask? What are the advantages of using umask?
What do you mean by symbolic and numeric permissions in Linux?
Why PATH variable is very Important. How to use PATH variable in Linux?
Shell scripting
Task schedulers: at, cron and anacron
How to manage processes: ps, kill, top, nice, renice and jobs
String processing: grep, sed and awk
Linux Networking Introduction
Remote Management using telnet and ssh
How to configure and use DHCP (Dynamic Host Configuration Protocol) Server
How to launch single website using Apache web server.
What is named based virtual hosting. How to implement named based virtual hosting. How to configure hosts file.
What is IP based virtual hosting. How to Implement IP based virtual hosting.
How to grant/deny access to websites on basis of IP address/Networks.
What is user authentication. How to make sure that only authenticated users are able to access the website.
How to enable users to launch their own websites using home directory.
How to launch HTTPS web site. How to create private key and generate self signed certificate.
How to Implement NFS (Network File System) Server
How to Implement Samba Server
This hands-on course starts from basics and takes you to some advance Linux concepts. The focus has been to make learning experience very simple and interesting. Everything has been explained by giving practical examples.