Unix and Linux: Redirect Error Output To null Command

I ‘m a new Linux system user. How can I redirect command error output /dev/null on a Linux or Unix-like system using Bash shell?   Your shell comes with three file descriptors as follows: stdin…

CentOS / RHEL: Install KornShell (KSH)

I am porting ksh script from Sun/Oracle Unix to Linux. How do I install ksh (KornShell) in CentOS / Fedora / Red Hat Enterprise Linux? How do I run and test ksh script on RHEL/CentOS…

Linux/Unix: Find Command Ignore Case Insensitive Search

I am a new Linux and Unix-command line user. I am using find command to search file called “fooBar.conf.sample” in my home directory. I do not know the case, it could be uppercase, lowercase, or…

Unix: Find Directory Name From Path

I am a new Unix shell programer. How can I extract the directory name from a full path (say /nas01/data/backups/file.tar.gz)? How do I get directory name from its path on a Linux or Unix-like system?…

Unix / Linux: Initialize Dot Files Without Restarting The Current Shell Session

I ‘m a new Linux, OS X or Unix-like system users. I’m using bash shell. I made changes to my $HOME/.profile ($HOME/.bash_profile) file. How can I restart my session without doing logout and login again?…

How to assign a grep command value to a variable in Linux/Unix

H ow do I store grep command output in shell variable? What is the syntax to store the command output into a variable in Linux or Unix?   You can use the grep command for…

How to use sed to find and replace text in files in Linux / Unix shell

I am a new Linux user. I wanted to find the text called “foo” and replaced to “bar” in the file named “hosts.txt.” How do I use the sed command to find and replace on…