Day 1
Day 1
Day 1
Cat command:
→ Cat filename.txt → displays the content of the file.
→ Cat file1.txt file2.txt → concatenates both files
→ Cat file1.txt file2.txt > newfile.txt → concatenates and copies the content into newfile.
→ Cat -n file1.txt → gives the number of lines used.
After creating the contents using cat and viewing the contents using nano press’q’ to exit.
Grep command:
→ grep “pattern” filename (find out pattern in the file)
→ grep -i “pattern” filename (case insensitive)
→ grep -n “pattern” filename (displays the line that matches the pattern)
→ grep -v “pattern” filename (invert match – displays the lines that don't match the pattern)
To add user → useradd username (At first while creating the account, it is created without the
password)
To add password → passwd username
To create a new group → groupadd groupname
To set group password → gpasswd -a groupname
The sudo command allows authorized users to perform administrative tasks without logging in
as the root user.
Boot process:
BIOS (basic input output system)
Boot loader (loads the kernel into the memory)
Kernel Loading
Mounting Partitions
Init system (systemd)
FIle permissions:
Read
Write
Execute
It is defined separately by User, Group and other
Important DIrectories:
1. /bin & /usr/bin
→ Contains executable programs
→ bin stands for “binary”
→ Contains essential commands that are required for the system to boot and repair itself (ex: ls,cp,mv)
→ /usr directory stands for ”Unix System Resources” containing user binaries (executable files ) that are
not necessary for the system’s basic functionality.
2. /sbin & /usr/sbin (system binary & system binaries for user commands)
→ contains executable programs that root users generally need.
DLL → Dynamic Link Libraries play a role similar to shared libraries. Contains compiled code and data
that multiple programs can use simultaneously
SUID bit:
→ Set User ID (SUID) bit
→ As a regular user, it allows the user to run the program with the permission of the file owner, giving it
temporary elevated privileges.
Command:
Find / -name “ “ 2>/dev/null
● find: This is the command used to search for files and directories in a directory
hierarchy.
● /: This specifies the starting point for the search, and in this case, it is the root directory,
which is the top-level directory in a Unix/Linux file system.
● -name: This option is used to search for files based on their names.
● 2>/dev/null: This part of the command redirects standard error (stderr) to /dev/null. The
2>/dev/null part ensures that any error messages generated during the search are
discarded and not displayed on the terminal. The result is a cleaner output with only the
found files and directories.
Rm -rf /home/cyberaces/” “
Rf - which is used to forcefully and recursively delete a directory and its entire contents,
including all subdirectories and files, without asking for confirmation. This command should be
used with extreme caution because once executed, the data cannot be easily recovered.