The tar (tape archiver) tool is the most commonly used application for data backups on Linux systems. It archives files in a special format, either directly on a backup media (such as tape) or to an archive file in the file system. The tar Command The tar command stores, lists, or extracts files in an […]
Archives for December 2017
How to use command line shell functions in Linux
Functions, a powerful feature of shell programming, is a group of commands organized by common functionality. These easy-to-manage units, when called return a single value, and do not output anything. Using a function involves two steps: 1. Defining the function 2. Invoking the function Shell function Vs shell alias Shell functions and aliases are different […]
How to disable auto deletion of the files in /tmp and /var/tmp directories in CentOS / RHEL 5,6
If files/directories in /tmp have not been accessed for a long time, they may be removed automatically. “tmpwatch” cleans up the contents of /tmp or other temporary directories like /var/tmp. Cleaning up unaccessed files in /tmp is a default function of package “tmpwatch”, which provides a cron job /etc/cron.daily/tmpwatch. This is a shell script kicked […]
How to use shell aliases in Linux
What is an alias An alias is a shorthand shell notation that allows you to customize and abbreviate commands. Aliases are available in all shells. A common syntax to define an alias on command line is as follows: $ alias name=command_string If the first word on the command line is an alias, the shell replaces […]
Examples of creating command alias in different shells
Alias for commands lets you define your own short easy to remember command shortcuts. Below are some examples of defining command aliases permanently into the different shells like bash, ksh and sh. You can also define aliases on command line, but they will not persist after you change the shell or logout of the shell. […]
Understanding the job control commands in Linux – bg, fg and CTRL+Z
Whats a job in Linux A job is a process that the shell manages. Each job is assigned a sequential job ID. Because a job is a process, each job has an associated PID. There are three types of job statuses: 1. Foreground: When you enter a command in a terminal window, the command occupies […]
How to find all the sparse files in Linux
Sparse files are files that have large amounts of space preallocated to them, without occupying the entire amount from the filesystem. They are useful for reducing the amount of time and disk space involved in creating loop filesystems or large disk images for virtualized guests, among other things. The term “sparse file” is used to […]
How to kill Processes in Linux using kill, killall and pkill
What is a process A process, also known as a task, is the running form of a program. Programs are stored on disk and processes run in memory. Processes have a parent/child relationship. A process can spawn one or more children. Multiple processes can run in parallel. Listing System Processes The process status (ps) command […]
How to create sparse files in Linux using ‘dd’ command
What are sparse files Sparse files are files that have large amounts of space preallocated to them, without occupying the entire amount from the filesystem. They are useful for reducing the amount of time and disk space involved in creating loop filesystems or large disk images for virtualized guests, among other things. Sparse files are […]
Troubleshooting common NFS issues in Linux
The post discusses most commonly occurring NFS issues in Linux and how to resolve them. 1. Error: “Server Not Responding” The Network File System (NFS) client and server communicate using Remote Procedure Call (RPC) messages over the network. Both the host->client and client->host communication paths must be functional. Use common tools such as ping, traceroute […]