pr -l60 draft?
LD_LIBRARY_PATH
is an environment variable used for debugging a new library or a non-standard library. It is also used to identify the directories that need to be searched for; in order to do this, the path to search for the directories needs to be specified.setenv—LD_LIBRARY_PATH--$PATH?
Hard Links | Soft Links |
---|---|
It includes original content. | It includes the original file location. |
Hard links are faster as compared to soft links. | Soft links are slower. |
It shares similar inode numbers. | It shares different inode numbers. |
There is no relative path for hard links. | Relative paths are used for soft links. |
It didn’t link the directories. | It links the directories. |
Any change in this link reflects other files directly. | Every change in this link reflects its hard link and the actual file directly. |
It uses less memory. | It uses more memory. |
ln
’ command. The general command to create a symbolic link is as follows :ln -s <existing_source file> <optional_symbolic link>?
mkdir /mnt/mountpnt
will create the mountpnt directory as the mount point.<partition> <mount_point_directory>
to complete the mounting.sudo umount <mount_point_directory>
` for unmounting. If you want to learn more about the mount command in Linux /etc/resolv.conf
file.fork()
: Used to create a new process.exec()
: Execute new process.wait()
: wait until process execution.exit()
: exit from the process.getpid()
: to find the unique process id. getppid()
: to find the unique parent process id. free -m
vmstat
top
htop
pvcreate
command.vgcreate
command.
lvcreate
command.pvcreate
(to initialize physical volumes), vgcreate
(to create volume groups), lvcreate
(to create logical volumes), lvresize
(to resize logical volumes), and lvremove
(to remove logical volumes).INODE
stores many details about files, including the number of links, access mode, file type, file size, ownership, etc.unique Id
provided to all processes. It is used to identify a running process uniquely throughout the computer until the process ends.
umask [-S] [mask]?
pwd
: Displays the path of the present working directory.$ pwd
ls
: Lists all the files and directories in the present working directory.$ ls
cd
: Used to change the present working directory.$ cd <path to new directory>
mkdir
: Creates a new directory$ mkdir <name (and path if required) of new directory>
rmdir
: Deletes a directory$ rmdir <name (and path if required) of directory>
resize2fs
command as follows:resize2fs /dev/mapper/myvg-mylv 10G?
lvreduce
command as follows:lvreduce -L 10G /dev/mapper/myvg-mylv?
chmod
command to change the file permissions of the directories. It offers a simple way to control the read and write permissions. For instance, if you want to change the permission of the ABC.sh script and give it the write and executable permission, you can run the below command:chmod u+wx ABC.sh?
chmod
command is not limited to the write (w), read (r), and executable (x) permissions because there are symbolic modes and numeric modes. pgrep <process_1>?
ps -e | grep -i <process_1> ?
rsync <options> <source> <destination>?
rsync -av ~/Documents ~/Downloads?
rsync -avz --delete ~/Documents ~/Downloads?
Ron
,” and provide a password for accessing the system:useradd Ron
passwd Ron ?
Shawn
”:adduser Shawn
passwd Shawn?
ps
command displays the current process status of the system. And it displays the processes id’s with some other related data also. Ps [options]?
[root@rhe17~]# ps
PID TTY TIME CMD
12330 pts/0 00:00:00 bash
21621 pts/0 00:00:00 ps?
>
operator is used to redirect the standard output (stdout
) of a command to a file or device. If the specified file already exists, it will be overwritten. If it does not exist, a new file will be created.command > output.txt?
>>
operator is similar to >
, but it appends the output of a command to the specified file instead of overwriting it. If the file does not exist, a new file will be created.command >> output.txt?
<
operator is used to redirect the standard input (stdin
) of a command from a file. It allows the command to read input from the specified file instead of from the keyboard.command < input.txt?
Here Document (<<) : The <<
operator is used to create a temporary input stream for a command. It allows multiple lines of input to be provided directly within the shell script without the need for an external file.command << EOF
This is line 1
This is line 2
EOF?
<<<
operator is used to redirect a string as input to a command. It allows a string to be passed as input to a command without the need for an external file or here document.command <<< "input string"?
|
operator is used to redirect the standard output (stdout
) of one command as the standard input (stdin
) of another command. It allows the output of one command to be passed as input to another command.command1 | command2?
/proc
” file system is a virtual file system in Linux that provides real-time information about running processes and kernel configurations. It is a dynamic interface, representing data in memory rather than physical files on disk. It is valuable for monitoring, debugging, and accessing system information./proc/stat
” file. To see the memory usage of a specific process with PID 12345, you can check the “/proc/12345/status
” file./proc
” file system is a powerful and dynamic interface that provides valuable system information and insights for system administrators, developers, and monitoring tools in Linux-based systems. :wq
saves the current work and exits the VI.:q!
exits the VI without saving current work.
vi
editors.x
deletes a current character.dd
deletes the current line.
ping
command checks the connection status between the destination and source. In other words, this command checks whether a network is present and if the host is attainable. We can use the ping command to check both the IP address and name of the system.
Is-I
` command to find out the total number of hard links in a file. And we can create Hard links using the following command:$ ln [original filename] [link name]?
$ ln -s [original filename] [link name]?
/etc/passwd
’ that Linux usually keeps its user account details, including the one-way encrypted passwords. However, this file can be accessed with the help of different tools, which might throw security issues./etc/passwd
as in the traditional method but with the password stored as a single ‘x
’ character, i.e., it is not the original password that is actually stored in this file. /etc/shadow
will have the encrypted password, along with the other relevant information, such as the account/password expiration date, etc. Most importantly, the latter file is readable only by the root account, and thus it minimizes the security risk.pwconv
POP3
mail-only account to the /bin/false
shell. However, assigning a bash shell to a POP3
mail-only account gives the user the login access, which is usually avoided. The /bin/nologin
shell can also be used. This shell is provided to the user when we don’t want to give shell access to the user. The user cannot access the shell, and it rejects shell login on the server as in Telnet. It is mainly meant for the security of the shells.POP3
is basically used for downloading mail-to-mail
programs. So for the illegal downloading of emails on the shell, this account is assigned to the /bin/false
shell or the /bin/nologin
shell. Both shells are the same as they do the same work of rejecting the user login to the shell./etc/sysconfig/kudzu?
SAFE
to ‘yes
.’ ext2
file system.ext2
and ext3
is that ext3
supports journaling.ext2
file system must be checked for consistency by the e2fsck
program. This is a time-consuming process and during this time, any data on the volumes is unreachable.ext3
file system means that this sort of a file system check is no longer necessary after an unclean system shutdown. The only time a consistency check occurs while using ext3
is in certain rare hardware failure cases, such as hard drive failures. The time to recover an ext3
file system after an unclean system shutdown does not depend on the size of the file system or on the number of files. Rather, it depends on the size of the journal used to maintain consistency. The default journal size takes almost a second to recover, depending on the speed of the hardware. Comparison Factors | Process | Thread |
---|---|---|
Creation time | Creation time is higher | Creation time is less. |
Dependency | It is independent because it does not share memory. | It depends on other threads because they share some memory with other threads. |
Resource | Resource use is higher | Requires lesser resources |
Termination time | The termination time is higher | The termination time is less. |
ulimit -u 50 ?
find <directory> <file>?
Linux.txt
file located in the Downloads directory through the below command :find ~/Downloads -name Linux.txt?
Linux.txt
in the Downloads directory and subdirectories. strace ls?
–name
"process.txt
". It will look for the current directory for a file called process.txt
.
iptables -L?
iptables -A <chain> <options> -j <target>?
<chain>
: Specifies the chain where you want to define a new rule.<options>
: Defines the conditions for the rule, like ports, protocols, etc.-j <target>
: Defines the target action when the packet matches the rule.iptables
rules get automatically removed after the system reboot, but you can use the following command to make the rules persistent:iptables-save > /etc/iptables/rules.v4?
gzip
compression.shivaji
” with gzip compression. We use the following command.tar -czvf shivaji.tar.gz files?
files
”tar -xzvf shivaji.tar.gz?
netstat -tuln?
/etc/network/interfaces
. Open the file with a text editor and modify the configuration to set a static IP address, subnet mask, gateway, and DNS servers.iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4?
sudo visudo?
user_name ALL=(ALL) ALL?