Important Points- Linux
Linux has super-user account called “root“.
- Root is the most powerful account that can create, modify, delete accounts and make changes to system configuration files.
Linux is a case-sensitive system.
- ABC is NOT same as abc
Avoid using spaces when creating files and directories
Linux kernel is not an OS. It is a small software within Linux OS that takes commands from users and pass them to system hardware or peripherals.
Linux is mostly CLI (Command Line Interface) not GUI (Graphical User Interface)
Linux is very flexible as compared to other OS.
PuTTY Software-
PuTTY software is a free and open source software tool
It is used to connect to remote systems and perform tasks like system administration, troubleshooting and file transfer.
Note: If you are using windows10 or above and MAC OS then we don’t need this software to connect our remote system i.e., Linux.
Connecting to Linux Machine using SSH command line-
Command Prompts and Getting Prompt Back
To check the ip address use-
ifconfig
orip addr
To use
ifconfig
in 7.5 or later version then runyum install net-tools
To get your prompt back -
Ctrl+C
Introduction to FileSystem
File System-
It is a system used by an OS to manage files. The system controls how data is saved or retrieved.
cd
- stands for change directory. It is the primary command for moving you around the filesystem.
pwd
- stands for print working directory. It tells you where your current location is.
ls -l
- stands for list. It lists all the directories/files within a current working directory.
ls -ltr
- it will list the files by sorting based on timestamp.
whoami
- it provides the username
su -
- to enter into the root directory
clear
- to clear the screen
cd ..
- to go back to previous directory
passwd <userid>
- to change the password
rm
- to remove the files and directories
Linux File and Directory Properties-
File System | Meaning |
- | Regular File or text file |
d | Directory |
l | Link |
c | Special File or device file (like keyword/mouse attached file) |
s | Socket |
p | Named pipe |
b | Block device (like Hard Drives/ USB Drives) |
What is Root?
There are 3 types of root on Linux system-
Root account: root is an account or a username on Linux machine and it is the most powerful account which has access to all commands and files.
Root as /: the very first directory in Linux is also referred as root directory.
Root home directory: the root user account also has a directory located in /root which is called root home directory.
Files System Paths-
There are two paths to navigate to a filesystem
Absolute Path- It always begins with a “
/
“. Example-cd /var/log/samba
Relative Path- It does not begin with a “
/
". Example-cd /var
>cd log
>cd samba
Creating Files and Directories
Creating Files
touch
- to create the empty filecp
- copying a existing file and then creating a same new filevi
- creating a filevi bart
-to exit use -
:wq!
Creating Directories
mkdir
Copying Directory-
cp -R <source_folder> <destination_folder>
Find Files and Directories
Two main commands are used to find files/directories
find-
find . -name “<filename>“
locate-
locate <filename>
Difference- locate
uses a prebuilt database, which should be regularly updated, while find
iterates over a filesystem to locate files. thus, locate is much faster than find, but can be inaccurate if the database(can be seen as a cache) is not updated. To update locate database run updatedb
WildCards-
A wildcards is a character that can be used as a substitute for any of a class of characters in a search-
*
- represents zero or more characters?
- represents a single characters[ ]
- represents a range of characters\
- as an escape character^
- the beginning of the line$
- the end of the line
Soft and Hard Links
inode - Pointer or number of a file on the hard disk
Soft Link = Link will be removed if file is removed or renamed
Hard Link = Deleting renaming or moving the original file will not affect the hard link
Hands-on > Soft Link:
Create a file “hulk“ in
home
directory then go to/tmp
location and create a soft link-Add some text in the
home
directory file and then check for the reflection under/tmp
hulk file -Now, check for the inode number for both the locations-
Next step is remove the hulk from
home
directory and then check the details-Now, this
/tmp
location hulk file got turned into red
Hands-on > Hard Link:
Create a file “hulk“ in
home
directory then go to/tmp
location and create a hard link. Add some text in thehome
directory file and then check for the reflection under/tmp
hulk file -Add something new in the
/home
directory file and check for the reflection in/tmp
location-Now, check for the inode and then delete the file from /home directory and then check in /tmp location, you should be able to access the hulk file-
Thanks for going through this blog, Happy Learning !! 😁