Welcome back to UNIX Sysadmin Boot Camp. You’ve had a few days to get some “reps” in accessing your server via SSH, so it’s about time we add some weight to your exercise by teaching you some of the tools you will be using regularly to manage your server.
As we mentioned earlier in this series, customers with control panels like cPanel/WHM and Plesk might be tempted to rely solely on those graphical interfaces. They are much more user-friendly in terms of performing routine server administration tasks, but at some point, you’re going to need to get down and dirty on the command line. It’s inevitable. This is where you’ll use bash commands.
Here are some of the top 10 essential commands you should get to know and remember in bash. Click any of the commands to go to its official “manual” page.
man
– This command provides a manual of other bash commands. Want more info on a command? Typeman commandname
, and you’ll get more information about “commandname” than you probably wanted to know. It’s extremely useful if you need a quick reference for a command, and it’s often much more detailed and readable than a simple--help
or--h
extension.ls
– This command lets you list results. I showed you an example of this above, but the amount of options that are available to you with this command are worth looking into. Using the “manual” command above, runman ls
and check out the possibilities. For example, if you’re in/etc
, runningls –l /etc
will get you a slightly more detailed list. My most commonly used list command isls –hal
. Pop quiz for you (where you can test yourman
skills): What does the-hal
mean?cd
– This command lets you change directories. Want to go to/etc/
?cd /etc/
will take you there. Want to jump back a directory?cd ..
does the trick.mv
– This command enables you to move files and folders. The syntax ismv originalpath/to/file newpath/to/file
. Simple! There are more options that you can check out with theman
command.rm
– This command enables you to remove a file or directory. In the same vein as themv
command, this is one of those basic commands that you just have to know. By runningrm filename
, you remove the “filename” file.cp
– This command enables you to copy files from one place to another. Want to make a backup of a file before editing it? Runcp origfile.bla origfile.bak
, and you have a backup in case your edit oforigfile.bla
goes horrendously wrong and makes babies cry. The syntax is simply:cp /source /destination
. As with the above commands, check out the manual by runningman cp
for more options.tar
– On its own,tar
is a command to group a bunch of files together, uncompressed. These files can then be compressed into .gzip format. The command can be used for creating or extracting, so it may be a good idea to familiarize yourself with the parameters, as you may find yourself using it quite often. For a GUI equivalent, think 7-zip or WinRAR for Windows.wget
– I love the simplicity of this little command. It enables you to “get” or download a target file. Yes, there are options, but all you need is a direct link to a file, and you just pull one of these:wget urlhere
. Bam! That file starts downloading. Doesn’t matter what kind of file it is, it’s downloaded.top
– This handy little binary will give you a live view of memory and CPU usage currently affecting your machine, and is useful for finding out where you need to optimize. It can also help you pinpoint what processes may be causing a slowdown or a load issue.chmod
– This little sucker is vital to make your server both secure and usable, particularly when you’re going to be serving for the public like you would with a web server. If you read about how I learned to stop worrying and love the bomb, er permissions, you should be familiar with this command and its connotations. Combine good usage of permission and iptables, and you have a locked down server
When you understand how to use these tools, you can start to monitor and track what’s actually happening on your server. The more you know about your server, the more effective and efficient you can make it. In our next installment, we’ll touch on some of the most common server logs and what you can do with the information they provide.
Did I miss any of your “essential” bash commands in my top 10 list? Leave a comment below with your favorites along with a quick explanation of what they do.
-Ryan
Related Posts:
- Lilah Brown's Planets, Part II (or, Season II preview) [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Snow White needs a bailout [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- To the moon [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- S/1 90482 (2005) needs your help [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- We'll always have Regulus [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Orcus Porcus [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Kant's Crowded Universe [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Look up! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Baby Pictures [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Encore: Yelping at Saints [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Godspeed [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Heavens above! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Homeward bound [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Sony Pictures and the end of the world [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Thank you from the future [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Lunar dreams [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The first of the Pluto books! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Don't try to blame it on Rio [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Rio roundup [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The long road to a Titan storm [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Planetary Placemats [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Fog! Titan! Titan Fog! (and a peer review experiment) [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Millard Canyon Memories [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The problem with science [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- P.S. on the problem with science [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- How Big is 10 TB? [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Showing You Your Servers [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Pick Your Partnership: Referral Partners, Resellers and Affiliates [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Server Form Factors: Towers v. Rack-Mounts [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Lights-Out in the Data Centers [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Disruptive Technologies: Virtualization and The Cloud [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Know Thy Backups – Part I [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Know Thy Backups – Part II [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Boo Bash 2009 – Desktop Costume Included! [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- Why No One Will Talk About “Cloud Computing” in 10 Years [Last Updated On: November 8th, 2009] [Originally Added On: November 8th, 2009]
- The end of the fall [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- We Love ‘Server Huggers’ [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- All About the Cloud: An Interview with Dell’s Cloud Evangelist [Last Updated On: December 13th, 2009] [Originally Added On: December 13th, 2009]
- Happy Solstice [Last Updated On: December 21st, 2009] [Originally Added On: December 21st, 2009]
- A ghost of Christmas past [Last Updated On: December 31st, 2009] [Originally Added On: December 31st, 2009]
- Learning from a Blender [Last Updated On: January 5th, 2010] [Originally Added On: January 5th, 2010]
- Changing my world [Last Updated On: January 6th, 2010] [Originally Added On: January 6th, 2010]
- A Server. From Scratch. [Last Updated On: January 7th, 2010] [Originally Added On: January 7th, 2010]
- The Planet Sand Castle: Upgrade Your Sandbox [Last Updated On: January 12th, 2010] [Originally Added On: January 12th, 2010]
- Hosting for Haiti [Last Updated On: January 20th, 2010] [Originally Added On: January 20th, 2010]
- Redefining Value [Last Updated On: January 26th, 2010] [Originally Added On: January 26th, 2010]
- My Experience as a Newbie at The Planet [Last Updated On: January 28th, 2010] [Originally Added On: January 28th, 2010]
- Confessions of Another New Planeteer [Last Updated On: February 1st, 2010] [Originally Added On: February 1st, 2010]
- How I Learned to Stop Worrying and Love Permissions [Last Updated On: February 11th, 2010] [Originally Added On: February 11th, 2010]
- Where at The Planet is Rachel? [Last Updated On: February 15th, 2010] [Originally Added On: February 15th, 2010]
- The Planet Storage Cloud: FYI [Last Updated On: February 19th, 2010] [Originally Added On: February 19th, 2010]
- Meet us in March [Last Updated On: February 25th, 2010] [Originally Added On: February 25th, 2010]
- The Planet in “The Channel” [Last Updated On: March 2nd, 2010] [Originally Added On: March 2nd, 2010]
- The Planet Server Challenge [Last Updated On: March 13th, 2010] [Originally Added On: March 13th, 2010]
- The Definitive Guide to Finding The Planet at SXSW [Last Updated On: March 13th, 2010] [Originally Added On: March 13th, 2010]
- The SXSW Iron Geek Champion! [Last Updated On: March 15th, 2010] [Originally Added On: March 15th, 2010]
- Drinking from the Fire Hose [Last Updated On: March 16th, 2010] [Originally Added On: March 16th, 2010]
- The Fastest Hands at SXSW [Last Updated On: March 17th, 2010] [Originally Added On: March 17th, 2010]
- System.out.println(“Hello World!”); [Last Updated On: March 22nd, 2010] [Originally Added On: March 22nd, 2010]
- Westmere – Get it Here [Last Updated On: March 23rd, 2010] [Originally Added On: March 23rd, 2010]
- Orbit on Your iPhone: A Sign of Things to Come [Last Updated On: March 24th, 2010] [Originally Added On: March 24th, 2010]
- #ShowMeMyServer 2.0 [Last Updated On: March 25th, 2010] [Originally Added On: March 25th, 2010]
- Get to Know Your Visitors [Last Updated On: March 30th, 2010] [Originally Added On: March 30th, 2010]
- The Next Big Thing in Hosting: The Hostatulator [Last Updated On: April 1st, 2010] [Originally Added On: April 1st, 2010]
- Storage Cloud and the City [Last Updated On: April 4th, 2010] [Originally Added On: April 4th, 2010]
- American Heart – Why I Walk [Last Updated On: April 7th, 2010] [Originally Added On: April 7th, 2010]
- The Cake Shouldn’t Be a Lie [Last Updated On: April 8th, 2010] [Originally Added On: April 8th, 2010]
- April Showers Bring May Flowers [Last Updated On: April 9th, 2010] [Originally Added On: April 9th, 2010]
- First at The Planet: Nehalem EX 4-Socket Servers [Last Updated On: April 15th, 2010] [Originally Added On: April 15th, 2010]
- Intel Guest Blog: Xeon 5600 [Last Updated On: April 16th, 2010] [Originally Added On: April 16th, 2010]
- Inside the Office: A Birthday Surprise [Last Updated On: April 18th, 2010] [Originally Added On: April 18th, 2010]
- The Planet @ Cloud Expo East [Last Updated On: April 19th, 2010] [Originally Added On: April 19th, 2010]
- The Planet @ ad:tech SF [Last Updated On: April 22nd, 2010] [Originally Added On: April 22nd, 2010]
- ad:tech Server Challenge [Last Updated On: April 22nd, 2010] [Originally Added On: April 22nd, 2010]
- ad:tech Panel: Developing Communities Online [Last Updated On: April 23rd, 2010] [Originally Added On: April 23rd, 2010]
- The Planet @ Interop Las Vegas [Last Updated On: April 27th, 2010] [Originally Added On: April 27th, 2010]
- Overflowing With Value: 10TB is Back! [Last Updated On: April 28th, 2010] [Originally Added On: April 28th, 2010]
- The Cloud is NOT the Revolution [Last Updated On: April 29th, 2010] [Originally Added On: April 29th, 2010]
- The Importance of Orbit 2.0 [Last Updated On: May 5th, 2010] [Originally Added On: May 5th, 2010]
- The Planet @ Web 2.0 Expo [Last Updated On: May 6th, 2010] [Originally Added On: May 6th, 2010]