6 Command Line Tools That Make Linux Easier

One of the things that’s always attracted me to Linux is the simplicity and elegance of working on the command line. Even with all the GUIs, Web apps and touch-screen interfaces out there, it’s nice to type in a couple of commands and get the results  displayed on a terminal. No frills, no fuss, just  formatted information that I can use right away. Typically, I leave a terminal up on the XFCE desktop and switch over as I need to.

Here are some of the command line tools I regularly use.

top

The top command prints out a near-real-time text display of my machine’s processes and metrics. The image below shows a screen shot of the top session I had up as I wrote this story. Across the top you’ll see up-time, number of users and load average. On the second row, there’s the number of tasks. Further down you’ll find memory and swap tallies. Finally, below the white background line are the details of the running tasks. Top gives me a great snapshot of how everything is running.

The top command line tool

history

On most Linux systems, you can use the up and down arrow in a terminal to recall commands. Type in a few commands, then hit the up arrow to bring them back up. Instead of up-arrowing 100 times to get back to something I used yesterday, I rely on history to show me the commands I’ve used recently. In the screen below displays my history. The leftmost field is the process ID and other field is the command. To recall a commant, type a bang (!) symbol.

The history command line tool

df

df shows the disk space on my your file systems. Take a look at this screen for an example. Notice that the root file system (/) is at around 25 percent capacity and my home (/home) file system is at 100 percent. I guess it’s time to archive off a few directories.

The df tool

locate

When writing, I frequently have to go looking for files. To me, it’s much better to use the command line than an X Window-based file manager. I was never very good at visually scanning long lists to find the file I want. It’s so much simpler to punch in “locate” and a file name.

cat

Cat is short for concatenate. I use cat to print files to my terminal screen and you can view just about any text file with it. I use cat to look at log files and HTML files, and to read in Arduino data over the USB port.

curl

Do you want to see the plain HTML text for a website? Just type “curl” and the URL. You’ll get a printout of the file with all the tags. Yes, it’s a little hard to read sometimes. To deal with that, maximize the X terminal window and the text will fill out the screen. Long inline URLs show up much better that way.

On our Linux Talent Community discussion boards, we’ve had some comments about the power of the command line. It certainly isn’t dead, and it offers great time-saving advantages over a graphical environment.

Do you use the Linux command line interface? Feel free to share your best tips in the comments below.

Comments

  1. BY Larry Dennis says:

    Why curl to view a website? Ever here of lynx?

  2. BY Me says:

    Linux is not the only OpSys with a powerful command line; VMS and other “mainframe” operating systems rock. Even versions of DOS were very helpful.

    • BY Larry Dennis says:

      Dude! I worked on VMS systems all during the 80′s. After working with linux (among many other unicies) I’d hate to go back. And DOS? That was a poor man’s sustitute for another DEC OS like RXS-11. Been there done that!

  3. BY Rich W says:

    less is more

  4. BY Matt says:

    Some people still use lynx for the ars technica site :)

  5. BY Sergey Sarbash says:

    Terminal Emulator’s window is always opening on my comp.

    htop – better top.
    mc – convenient file manager.
    w3c – another lynx :)
    enca – helps to deal with plain text’s charsets.
    mediainfo – all about your music/video/image files.
    less is already mentioned.
    mplayer – listen your audio, watch your video.
    mocp, cmus – audioplayers for console.
    ssh – remote administration.

    These just are a few of many others.
    OMG! There is a plethora of useful tools for command line. “True admin” uses it constantly.
    I just would mention that the real power of cli might be unrevealed.

  6. BY Mike Ray says:

    the surfraw interface to lynx (which isn’t by default but has to be configured) makes lynx (or links or elinks) far more powerful with it’s use of “elvi”. For example:

    $sr google who wrote surfraw

    will fire off a browser (by default a gui one) with your search. With lynx you have to navigate multiple steps. No fun.

    Also, byobu (tmux/screen) make the terminal interface far more useful.

    And don’t forget the nice z and b options for top – use color and bold (and press ’1′ if you have multiple CPUs).

Post a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>