Pages
-
Recent Posts
- Revolving Door: MPAA Hires Chief USTR Negotiator Behind ACTA And TPP’s IP Chapter
- Copyright Maximalists’ Incredible Sense Of Entitlement: If It Challenges The Biz Model We Chose, It Must Be Illegal
- Turkey’s Prime Minister Sues His Own Country Over Twitter
- Picturefill 2
- Police File On Student ‘Bullied Into Committing Suicide’ Strangely Lacking In Evidence Of Bullying
Archives
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- December 2008
- November 2008
- October 2008
Meta
Category Archives: shell
PHPHOST BLOG
Web Hosting Related Articles You May Need
[one-liner]: Improving the performance of SSH Tunnels using Alternative Ciphers; when displaying X11 Apps
Background
Have you ever used an ssh tunnel to try and remotely display an X windowed application and then wished you hadn’t, because the performance was so bad you’d be waiting till next week for the window to come up?
Read on because here’s how you can make this much more tolerable & usable.
Solution
There are 2 […]
Readers who viewed this page, also viewed:
Posted in one-liner, shell, ssh, Syndicated, tip, tips & tricks
Comments Off on [one-liner]: Improving the performance of SSH Tunnels using Alternative Ciphers; when displaying X11 Apps
Why are “executables” such as reboot, shutdown, and vgscan symlinks in the /sbin directory?
Background
If you’ve ever gone poking around in your Linux system’s /sbin directory the site of files like this might make you scratch your head.
1
2
3
4
5
6
7
8
lrwxrwxrwx 1 root root 3 Jun 7 2011 vgmerge -> lvm
lrwxrwxrwx 1 root root 3 Jun […]
Readers who viewed this page, also viewed:
[one-liner]: Debugging Bash Scripts
Background
From time to time it’s useful if you can turn up the debugging messages that come from Bash, when working out either interactive or shell script problems. Here are 2 methods that can help in getting down to the details.
Solution
There are essentially 2 methods.
Method #1: -x method
When writing a shell script you’ll sometimes want to […]
Readers who viewed this page, also viewed:
Posted in bash, one-liner, script, shell, Syndicated, tips & tricks
Comments Off on [one-liner]: Debugging Bash Scripts
[one-liner]: How do you capture the status of a command ($?) in Bash, when run through a pipe?
Background
While answering questions on the stackexchage website Unix & Linux I saw the following question which was about something I’d encountered, but until today never knew how to accomplish, so I’m posting it here for my own reference in the future.
The question?
How do you get the exit status ( $? ) from the command haconf […]
Readers who viewed this page, also viewed:
Posted in bash, one-liner, script, shell, Syndicated, tips & tricks
Comments Off on [one-liner]: How do you capture the status of a command ($?) in Bash, when run through a pipe?
[one-liner]: Overview of Bash I/O Redirection
Background
I recently came across this question on the Stackexchange site Unix & Linux. This question was interesting in the sense that it covered much of the I/O redirection facilities that are available in the Bash Shell, so for posterity sake I’m adding my answer to this question here on my blog.
Solution
a number 1 = standard […]
Posted in bash, one-liner, script, shell, Syndicated, tips & tricks
Comments Off on [one-liner]: Overview of Bash I/O Redirection
[one-liner]: Redirecting an Already Running Program’s STDOUT to a File using dupx
Background
Recently I came across this really cool UNIX tool called dupx. I was looking for a way to connect to a program’s STDOUT and STDERR after I had already started it. This was a long running, think 30+ hours job, and I didn’t want to have to stop and restart it. As is the case […] Continue reading
Posted in centos, fedora, linux, one-liner, rhel, shell, Syndicated, sysadmin, tips & tricks
Comments Off on [one-liner]: Redirecting an Already Running Program’s STDOUT to a File using dupx
[one-liner]: Calculating & Sorting Disk Usage Using du
Background
Occasionally I want to calculate how much disk space is being consumed with a directory. Here are a couple of simple yet powerful one-liners that achieve this.
Solutions
method #1
This first choice is inefficient in the sense that it basically runs du twice. Once to generate a sorted list of the directories & files by size and […] Continue reading
Posted in bash, one-liner, shell, Syndicated, tip, tips & tricks
Comments Off on [one-liner]: Calculating & Sorting Disk Usage Using du
[one-liner]: Why is awk skipping the first line?
Background
I’ve used AWK for years but never had a reason to use it to split on anything except spaces until now. Hard to believe but I usually use sed to convert the separator characters to spaces.
1
2
# sed example
echo "this|is|a|string" | sed ‘s/|/ /g’
So I was trying to use AWK’s field separator variable, FS but […] Continue reading
Posted in awk, one-liner, shell, Syndicated, sysadmin, tips & tricks
Comments Off on [one-liner]: Why is awk skipping the first line?
[one-liner]: Making the Linux date Command Display the Month & Day in Single Digits
Background
Anyone that’s worked in a UNIX environment is probably somewhat familiar with the date command. Up until recently I had no reason to go beyond the typical use cases like the following:
1
2
3
4
5
6
7
# locale’s date & time
% date +%c
Fri 22 Jul 2011 10:22:29 PM EDT
# full date
% date +%F
2011-07-22
However, the problem came up where I needed […] Continue reading
Posted in linux, one-liner, shell, Syndicated, tips & tricks
Comments Off on [one-liner]: Making the Linux date Command Display the Month & Day in Single Digits
[one-liner]: Command-line Fu … Useful Linux Commands (repost)
Background
Came across these commands on another blog and wanted to create my own personal copy of these useful command-line examples.
Commands
1
2
3
4
% sshfs [email protected]:/path/to/folder /path/to/mount/point
# Mount folder/filesystem through SSH
# Install SSHFS from http://fuse.sourceforge.net/sshfs.html
# Will allow you to mount a folder security over a network.
1
2
3
4
5
% !!:gs/foo/bar
# Runs previous command replacing foo by bar every time that foo appears
# […] Continue reading
Posted in linux, one-liner, shell, Syndicated, sysadmin, tip, tips & tricks
Comments Off on [one-liner]: Command-line Fu … Useful Linux Commands (repost)