What is the Purpose of Using shift Command in Shell Scripts?
The purpose of the shift command shell script is to shift/move the positional arguments to the left that set each parameter to the lower position.
The purpose of the shift command shell script is to shift/move the positional arguments to the left that set each parameter to the lower position.
To switch between multiple versions of Java, list the available versions and switch between them using the “sudo update-java-alternatives –set
To check the currently used DNS server, consider the “resolv.conf” file or built-in tools such as ”dig”, and “nslookup” or use the “Network” settings (GUI).
To set the default gateway in Ubuntu, execute the “sudo ip route add default via
In Linux, the “daemon-reload” reloads the entire systemd unit files while the “reload” only reloads the specific service configuration files.
Python regex capturing groups enable you to capture specific parts of a string based on a specified pattern such as using (\b\d+) pattern for capturing digits.
This value error occurs due to various reasons such as creating an array with different dimensions, replacing a single array element with an array, etc.
To convert the Pandas series to a DataFrame the “pd.DataFrame()” function and “series.to_frame()” function is used in Python.
In Ubuntu, the alternatives to Notepad++ are “Nano”, “Gedit”, “Vim”, “Sublime text”, “Geany”, and “Kate”. Read this post for their detailed description.
The “/var/lib/apt/lists” directory stores all the package information downloaded from the ubuntu server when the user runs the “sudo apt command”.
To trim the leading and trailing whitespaces from each line in the output of a file/script, use the Linux pre-installed “sed” and “awk” command line tools.
To sort the output of the “ls” command by modification date use its “-t” argument, and also the “-l(list)” flag that displays the “date&time” of the file/directory.
In Linux, the pre-installed “xrandr” command offers the “newmode” and the “addmode” flags to set the custom resolution of the system monitor.
To reattach an existing screen session, use the “screen” tool followed by the “-r(reattach)” argument and the “SID” or the “specific session name”.
To count the total number of occurrences of the specified word/pattern, use the “grep” command with the “wc(word count)” and “tr(translates)” options.
To convert epoch timestamp to human-readable format use the “date” command, “awk” having starftime format, and the “localtime()” with the “echo” command.
To reinstall the “pip3” for Python3 and “pip” for Python 2 use the default “apt” package manager with superuser privileges or log in as a root user.
In Ubuntu, the “clean”, “autoclean”, and “autoremove” commands clean up the system cache, additional dependencies, and outdated versions of packages.
To add new lines, use the “-e(backspace interpreter)” and “$(bash variable)” with the “echo” command. An “echo” tool can also be used multiple times to do this.
In Linux and its distributions, the “curl” can be installed via default package managers i.e “apt” (Ubuntu/Debian), “yum” (CentOS/RHEL), and “dnf” (Fedora).
To generate a strong password, use the “urandom”, “makepasswd”, “gpg”, “apg”, “pwgen”, and “openssl rand” commands. It can also be done using the “Perl” script.
To update the NodeJS versions in Ubuntu, use the “NVM(Node Version Manager)”, “NPM(Node Package Manager)”, and “Binary Packages”.
In Linux, SUID, SGID, and Sticky bit are permission bits that are utilized to specify special permission rules for the file or directory.
gdm3, kdm, and lightdm are display managers of Linux that provide the interface for the login screen and can be installed or uninstalled.
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.
To add a newline character, the “\n” escape character, the “multiline strings”, and the “os.linesep” attribute of the os module are used in Python.
To extract dictionary values as a list, the “list()” function, “list comprehension”, “for loop”, “* operator”, and “map() function” is used in Python.
Google meet is an online platform for making audio or video calls. It is a super useful tool, especially if you are working remotely.
The “cd -” and “cd ~-” jump into the recently used directory but the “cd -” also prints that directory’s absolute path in the terminal.
The “find -name” locates the files/directories by different parameters name, extensions, or searching and deleting the particular file/directory.
To run a shell script in the background, use the “&(ampersand)” bash control operator and the built-in “nohup” command line tool.
The error is caused when the user tries to change the hostname, which is not found in the /etc/hosts file, and it is fixed by adding the hostname to that file.
In Ubuntu, the “wheel” group is a special user group that provides administrative access to certain users on a system to perform administrative tasks.
In Linux, the error “cp: omitting directory” represents that the “cp” command expects a file as the source, not a directory.
In Linux, to check the hard disk performance of the system, the user can consider the utilities such as “hdparm”, “dd ”, “iostat”, or the “Disks” tool.
In Linux, the best alternatives to photoshop software are “Gimp”, “Krita”, and “Inkscape”, which give similar functionalities.
To check the RAM size in the Linux, utilize the “/proc/meminfo file”, “free”, “top”, “vmstat”, “dmidecode”, “lshw”, or “hwinfo” utilities
To check the version of the package with pip, the “pip show
In bash scripting, the “if” loop is used to execute multiple conditional statements using “if-then fi”, and “if then else fi” and “if then else if fi” loop.
The “exit 0”, “exit 1”, and the “exit 2” returns the exit status of the bash shell script. The value of the exit command is stored in the “$(shell)” variable.
In Bash, the “declare” command sets the variable and functions alongside their attributes, “integer”, “string”, “array”, and “read-only” variables.
Linux offers the “systemctl” and “service” commands to restart the “SSH” service instantly. It can also be restarted by accessing the “/etc/init.d” directory.
In Linux, use the default package managers of Linux distribution, i.e., “apt(Ubuntu/Debian)” and “dnf(Fedora/CentOS/RHEL)” to completely remove the Virtualbox.
In Ubuntu, the “ls”, “locate”, and “grep” command-line utilities can be utilized to get the absolute path of the “php.ini” configuration file.
To change an IP address, utilize the “ip”, “ifconfig”, and the “nmcli” command line tools or the “Network” window in the GUI method.
To find and kill the zombie process on Linux, list down the zombie process, and send the SIGCHLD signal to its parent process.
To get the complete and exact list of the mounted file system in Linux, the built-in “findmnt”, “df” and “lsblk” utilities are considered.
The find -mtime +1 only returns files older than two days because it only returns the files modified in the last two or less than two days.
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.
Linux and its distributions offer the pre-installed “id”, “echo”, “lslogin”, and “getent” command line utilities for finding user ID from the terminal.
To give full permission to a folder and its subfolders, use the “chmod 777
To reduce the file size of the scanned PDF, use the command line utilities ghostscript (gs), and “ps2pdf” or utilize the PDF online compression tool.
The “substr” function of the “awk” command searches for the specified character/pattern starting from the particular position to an optional length.
The binary files in Linux are analyzed through the file, ldd, hexdump, strings, readelf, objdump, strace, ltrace, and xxd utilities.
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.
Ubuntu supports “apt” and “snap” package managers to remove the firefox browser completely. It can also be done using the “rm(remove)” command.
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.
Ubuntu has no default device manager. This post has listed the best alternatives for Device Managers. Read this post for installation methods
The “onworks” platform offers to run various operating systems on the browser. Read this post to check how it works for Linux.
The “remove”, “autoremove”, and “purge” functionalities of Linux OSs allow the user to get rid of the executables, dependencies, and configurations of Apache.
Compare OwnCloud vs NextCloud for self-hosted cloud storage. Learn about similarities and differences to make an informed choice.