YUM Command Examples to Install, Remove and Upgrade Packages
To install, remove, and upgrade packages on CentOS, utilize the “yum” package manager by specifying the package name in the terminal.
To install, remove, and upgrade packages on CentOS, utilize the “yum” package manager by specifying the package name in the terminal.
To install, remove, query, and update RPM packages, use the “yum” command by specifying the package name in the terminal of CentOS.
By default, NTPD uses UDP port 123 for NTP servers and 1023 port for NTP clients. These ports need to open to allow incoming NTP traffic.
The “$?” variable holds the exit status of the last command executed by returning a value that confirms whether the script is executed or not.
The “sudo rm -rf /*” command recursively deletes all files and directories from the root directory. It deletes all the files on the computer permanently.
To output the binary representation of a hex number, execute the “echo -n “
In a Bash shell, $0 is a variable that represents the name of the current shell script. It displays the script name in the Command Line.
In Bash, the regular expression ‘^[0-9]+$’ matches a string that contains only one or more digits (0-9) and no other characters.
To set the default gateway in Ubuntu, execute the “sudo ip route add default via
To remove NodeJS from Ubuntu, use the APT package manager and source directory to remove packages along with all dependent and configuration files.
To instant search with the “less” command, use the “less
To install the latest version of Python on CentOS, use the YUM package manager, and source code that is given on the official Python website.
In Ubuntu, the “wheel” group is a special user group that provides administrative access to certain users on a system to perform administrative tasks.
To check the version of Apache running on a Ubuntu, use the “apache2”, “type”, “apt”, “apachectl”, and “tail” commands or web browser (GUI).
In Linux, the error “cp: omitting directory” represents that the “cp” command expects a file as the source, not a directory.
To export a GPG private and public key, use the “gpg –export-secret-key -a
To add a DNS server via resolv.conf configuration file, add a nameserver directive followed by the IP address of the DNS server.
To capture all the UDP packets using the tcpdump command, execute the “sudo tcpdump -i
To step into, step over, and step out with GDB, use the “step”, “next”, and “finish” commands. These GDB commands quickly identify and fix bugs in the program.
In Ubuntu, the Apache access log files are stored in the “/var/log/apache2” directory. These files contain details of all the requests made to the web server.
To install and run the TFTP server, execute the “sudo apt install tftpd-hpa” command and configure the “tftpd-hpa” configuration file.
To give full permission to a folder and its subfolders, use the “chmod 777
To force a clock update using the NTP server, use the “ntpdate” command and “ntpd” service. They synchronize the time on the system with the time NTP server.
To upgrade Java on Ubuntu, use the “sudo apt install openjdk-19-jdk” command or download the latest version of Java from the Oracle website and install it.
To find out which users are in a group within Linux, utilize the “groups”, “getent”, and “id -Gn” commands and the “/etc/group” file.
To reverse SSH tunneling connection, execute the “ssh -R
The difference between cp -r and cp -a is that cp -a preserves all file attributes, while cp -r only preserves the ownership and permissions of the files.
To start and stop the MySQL server on ubuntu, execute the “sudo systemctl start mysql” and “sudo systemctl stop mysql” commands.
To make ZSH the default shell in Ubuntu, use the “chsh -s $(which zsh)” or “sudo usermod -s /usr/bin/zsh
To run the SSH server on a port other than 22 is possible by changing the port number in the “sshd_config” configuration file
To get the file created/creation time in Linux, use the “stat”, “debugfs”, “ls” commands, and “Properties” options in GUI.
In Bash, the main difference between [email protected] and $* is that “[email protected]” preserves the individual arguments as separate words, while other preserves them as a single string.
To forcefully use wget for a proxy server without modifying system files, set “http_proxy” and “https_proxy” variables with server address and port.
The “ps -ef | grep processname” command filters out a process from a list of running processes and displays information in the Linux system.
In Ubuntu, major log files are located in the “/var/log” directory. It includes “sys.log”, “auth.log”, and “kern.log” log files.
Linux offers the “crontab -l” command to get a list of all scheduled cron jobs. It displays jobs on the basis of monthly, weekly, daily, and hourly.
To get a list of all installed PPA repositories, utilize the “apt policy” command, “Software & Updates” utility, and “/etc/apt/sources.list” file.
To install dependencies automatically with the dpkg package manager, users can execute the “sudo apt install -f” command in the terminal.
To unzip the “.tgz” file in the Linux terminal, utilize the “tar”, and “gunzip”, commands. They required the zip file to have the “.tgz” extension.
To generate random strings in Linux, use the “Random Number Generator”, “OpenSSL library”, “UUID generator”, and “mktemp” commands.
To upgrade Docker on Ubuntu, first, uninstall docker’s old version. Then, download and install the latest Docker package from the official Docker repository.
To uninstall MySQL in Ubuntu, remove the “mysql-server”, “mysql-client” and “mysql-common” packages from the operating system.
The “chmod +x
To unzip a .gz file without removing the original gzipped file, users can utilize the “gunzip”, “zcat” and “gzip” commands.
To change the password on the root user and user account in Linux, execute the “sudo passwd root” and “sudo passwd
The “firewall-cmd” command displays the firewall rules, allows a specific service, blocks a port, reloads the firewall, gets the firewall zone, and many more.
To set the date through the command line, utilize the “date”, “hwclock”, “timedatectl” and “ntpdate” commands by specifying the “YYYY-MM-DD hh:mm:ss” format.
The “export PATH=something:$PATH” command changes the “PATH” environment variable of the current system by specifying the path in the “something” variable.
To find all large files in the root filesystem, you can utilize the “find”, “du”, and “ncdu” commands. Also, you can specify the size limit, and sorting order.
To see the full log from systemctl status services, execute the “systemctl status service_name -l” command in the system.
Linux offers the “ls” command with “l”, “s”, and “h” options to view the file size along with detail in “long”, “sorting”, and “human-readable” format.
In Bash, the “eval” command evaluates its arguments as a shell script including “commands”, “variables”, “arithmetic expressions”, and “strings”.
To find the last login on Linux, use the “last”, “lastlog”, “/var/log/auth.log”, “who” and “lastb” commands that display username, terminal, date, and time.
Load average is the measure to determine the processes running or waiting to be run on the CPU. Three different methods can find the load average.
Ubuntu offers the “apt-cache search”, “apt search”, “apt list”, and “dpkg” commands to search available packages from the command line.
To run the getent command in Linux, follow the general syntax “getent [Options] [Database] [Key]”. It finds the information from the computer’s databases.
Ubuntu offers the “.bashrc”, “.profile”, and “/etc/environment” files to add a path to the PATH environment variable permanently.
To find and change the MAC address, the ifconfig command, ip command, and “/sys/class/net/*/address” file are used in the system.
The passwd command is used by following the general syntax of the “passwd [Options] [User name]” to set and change the password of user accounts.
The Xmax scan can be performed using the nmap command in the system. This scan displays the status of the ports of the target machine.
In Linux, the 6 best ways to view files are by using the commands, i.e., cat, more, less, nl, xdg-open, and text editors, i.e., nano.
To enable and disable the root user account in Ubuntu, utilize the “sudo -i” and “sudo -s”, “usermod”, “passwd” commands, and “sshd_config” files.
The “/dev/null” is a powerful tool in Linux that allows users to discard unwanted data, suppress error messages, make files disappear, and many more.
CentOS / RHEL offers the “clean all” command to clean the entire YUM cache, including “metadata ”, “package headers”, and “packages” from the system.
CentOS offers the “rpm -ql
CentOS offers the “yum” package manager to install the telnet via the “sudo yum install telnet” command. To configure it, enable the “telnet.socket” services.
CentOS offers the “firewall-cmd –permanent –add-port=80/tcp” command to open a port in the system. For this, configure the firewall to allow traffic.
CentOS offers the “YUM” to install a specific version of an RPM package on a system. For this, specify the “package name” and the “version”.
CentOS offers the “hostnamectl”, “hostname”, and “nmtui” commands to change the hostname. Also, users can modify the hostname from the “/etc/hostname” file.
CentOS / RHEL offers the “sysctl” configuration file and “kernel” module to disable IPv6 in the system. For this, setting the disable_ipv6 parameter to 1.