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…

sed Tip: Delete All Blank White Spaces

I have a text file as follows: foo bar foobar How can I delete all leading and/or trailing blank spaces, tab from each line using sed command?   You can use sed command to delete…

Linux: Find Out Directory Size Command

I am a new Linux user. How do I find out size of a directory on Linux operating systems using command line options?   You need to use the du command: [a] Find and estimate…

Linux: Find Out How Much Disk Space Left On Hard Drive

I am a desktop support professional with experience working in a corporate call center environment. Recently, I started to admin RHEL based IBM Linux server. How do I determine how much disk space left in…

Awk Floating Point Number Addition Results Are Unexpected

I am using awk to grep ‘foo’ from a text file and cacluate sum of field # 7. But, result is rounded to an integer. I need exact result such as 385858.66 and not 385858…

Nginx Redirect Mobile / Smart Phone Traffic To Mobile Version Of the Web Site

I am a new nginx user and I would like to redirect all mobile / smart phone users from www.example.com to m.example.com domain. How do I detect a mobile phone browser in nginx? How do…

Linux: Log Everyone Out Of The System

I can login as root user on Debian or Ubuntu/RHEL/CentOS Linux based system. I need to log everyone off (all ssh users) to install new kernel and/or hardware. How do I do this on Linux?…

Unix: csh Shell Loop Example

C an you give me a simple loop example in csh shell in Linux or Unix like operating systems?   The C shell (csh) or the improved version, tcsh is a Unix shell that was…

Bash: Display Web Page Content In Terminal

H ow can I fetch HTML web page content from bash and display on screen using shell utilities?   You can use any one of the following tool or combination of all of them to…

Linux / Unix: Shell Script Find Out In Which Directory Script File Resides

I need to find out in which directory my bash script resides so that I can read config file called .backup .ignore .target. For example, if my script resides in >/home/foo/script.sh, I need to read…