If your company is about to employ Linux, and you're going to have to administer those servers, it's time for you to learn the Linux command line.
Image: iStockphoto.com/jean-marie guyon |
Linux has taken over the enterprise. It runs the backbone for many of
the largest companies. It's one of the biggest players in big data. If
you're serious about moving up the IT ladder, at some point, you're
going to have to know Linux.
And although the Linux GUI tools are now as good as those available for any other platform, some tasks will require a bit of command-line knowledge. But where do you begin? You start off where every Linux newbie should... with what I believe are five of the most important commands for new Linux admins to learn.
1: man
You probably saw this coming from a mile away. The man command is where a good portion of your Linux education will begin. That's right. Built into the very platform you're using is a massive collection of help files ready to get you up to speed on any command you need. Say, for instance, you want to get up to speed on the ip command (the replacement for ifconfig). Issue the command man ip and you'll get all the information you need to learn that command.Figure A
Nearly every command on your system should have a man page, all of which
are set up to follow a specific standard. You'll get the command
structure, information about all the flags, switches, and options,
command syntax, a history of the command, and related commands. If
you've ever hear someone say RTFM... consider that "m" to be "man page."
2: ls
That Windows command dir? It doesn't exist in Linux. Instead, we have ls.
This command will list the contents of a directory for you. But don't
think it's limited to listing filenames. Oh no. You can run ls with switches, like ls -l,to get a long description of filenames (permissions, file size, timestamp, etc.). You can even issue the command ls -la to include hidden files.
Figure B
3: mv
The mv command does one thing and it does it well: It moves files and folders. Okay, that's not entirely true. The mv command is also really good at renaming files and folders. Of course, if you look at it the right way, renaming a file or folder is actually just moving from one location to another... and giving it a different name. In other words, mv test test1 moves the test file into the same directory, only it gives it a different name.Figure C
4: rm
If you need to delete a file or folder, the rm command is what you need. As with the mv command, you should be careful with the rm command. In fact, because of the power rm wields, the developer included a switch that makes the command interactive. If you issue the command rm -i test you will be asked if you want to remove the regular file test. If you answer y, the file will be deleted. A simple n will prevent rm from removing the file.Figure D
5: grep
Say you need to edit a fairly lengthy configuration file, but you only need to edit a single line—one that contains the string of characters LOCAL_LINUX_LOCALE (that's not actually a thing). You probably don't want to have to look, line by line, for that entry. Instead, why not use the power of grep?Figure E
grep -n LOCAL_LINUX_LOCALE app.conf
Your take
The old image of every Linux user needing to know commands is long dead. Desktop Linux has come a long way from the days when it depended upon the command line. Even so, if you plan to administer Linux servers, you'll want to master some command line basics.Have you run across other commands that have been particularly useful? Share you experiences and advice with fellow TechRepublic members.
~ Jack Wallen
0 comments:
Post a Comment