Bash: 10 command line tools for beginners

Bash: 10 command line tools for beginners

I've made a list of my favourite tools which I use day to day and some light information about them.

Hello! This will be a short post on 10 basic Linux tools that I find useful for my day-to-day tasks as a bash user.

  1. History - This allows you to see the last 500 commands you’ve run stored in working memory, which can be configured to store more. There are also configurable options to not store commands by placing a space before the desired command.
    // In this example you can see I have added a space at the beginning, 
    // This is great for sensitive data like Environment Variables.
    export NAME=VALUE
  2. less +F - This is one I use when streaming live logs from apache's access logs. There's a similarity with this functionality with tail -f but this option isn't economical in comparison as it stores the streaming logs in memory which, if you are doing it for long periods, can cause performance issues.
    // stream logs real-time, I have used this for monitoring traffic when 
    // identifying malicious users
    less +F /var/log/httpd/access_log
  3. grep - I love this tool, I use it everywhere! Using this tool to grep through past run commands is a frequent habit of mine so I had to mention it here as it's saved me multiple times.

    // I work with Cloud-foundry periodically and find myself always 
    // forgetting obscure commands I forget to document (shh I know)
    history | grep 'cf service-update'
  4. jq - Now me and jq have a touch and go relationship. It's great for syntax-highlighting/prettifying a json payload that i've used curl to get and can be brilliant for grabbing specific information from multiple keys/objects from large data-dumps but i've found I don't use it enough to be efficient with it.

    echo '{"pets":{"type":"cat","name":"dog","breed":"goldfish"}}' | jq '.'
    "pets": {
     "type": "cat",
     "name": "dog",
     "breed": "goldfish"
  5. man - This is a command that you "should" open first after installing any new tool that you haven't used before. Written by the software creators it's a great source of truth to lean on when navigating the new tool. image.png

  6. tail (-n 10) - This tool is really good if you know you only want the last X number of lines, this could also be a really good use case for the Apache access logs. -n is line-count but you can also print X number of Bytes using the -c flag.


  7. head (-n 100) - Similarly to tail this shows you the first X lines of the file/output you want to look at. image.png

  8. alias - This is great for saving time with commands and I use it for workspaces I frequent (I separate my infrastructure and web app repos)

    //There are opportunities to get creative with this.
    alias infra="cd ~/infra"
    alias lab="cd ~/lab
  9. htop - htop is an interactive process viewer. More feature-heavy with differing views and the ability to kill processes without needing their PIDs. There is also a slimmed-down version of this called top.


  10. shred -u - Allows you to make a file almost impossible to recover! The -u automatically deletes the file after shredding which makes it great for sensitive data you've had to analyse but no longer need.


    If you found this helpful please like and share this blog post!

Hello, Just a short thank you for taking the time to read my blog, I'm planning on doing write-ups once a week and covering topics across the DevOps and SRE space.

Sam Crudge

DevOps and SRE @ Cyber-Duck

Did you find this article valuable?

Support Samuel (Sam) Crudge by becoming a sponsor. Any amount is appreciated!