Duncan Wither

Home Notes Github LinkedIn

Terminal Tut 1 - Meta Commands

Written: 05-Mar-2022

Meta Commands

There are two key meta commands that really unlocked the linux command line for me. They allow you to discover commands and how to use them without having to look at tutorials or happen across them through sheer serendipity alone. They are:

apropos
man

apropos allows you to find a command. A usage might be apropos spell to find a spellchecker, which would yield aspell amongst other results. The small description alongside the commands would allow you to see which was the best fit.

man is the manual page for each command 1. This explains how commands are used, and sometimes gives examples of common use-cases.

Use them in conjunction to discover and confirm programs that might be useful to you.

Basic Navigation

Beyond those two there are several basic commands I’d learn for simple navigation around folders2 :

  1. ls - list
  2. cd - change directory
  3. pwd - print working directory
  4. mv, rm, cp - move, remove and copy respectively allow you to change the location of files and folders. 3
  5. mkdir - make directory… pretty self explanatory
  6. find - finds files, somewhat unsurprisingly. I’d strongly recommend looking up basic usage because it’s so useful, but needs a little coaxing.

Further Exploration

These are functions I use a lot4

  1. grep - get regular expression - useful for searching a body of text. Tut 4 covers the basics of regex.
  2. cat - originally for concatenating files, this is useful as it prints a files contents to the terminal.
  3. head/tail - prints the top and bottom 11 lines of a file to the terminal. Useful for long files.
  4. rsync - a more advanced move command. It has powerful uses including moving files to and from remote servers.
  5. echo - echos the input back out on the terminal. Useful for debugging scripts.
  6. nano - Allows you to write and edit text files.
  7. sed - Stream EDitor - edits strings. Useful in conjunction with other commands.
  8. cowsay/figlet - you may need to install them, but they’re a bit of fun. Just run either with a couple words after.

Previous…

Terminal Tut 0 - Intro

Next…

Terminal Tut 2 - Chaining


  1. apropos actually works by searching the manual pages for the given term.↩︎

  2. Folders = Directories. Normally I’ll use the term folder, but directories appears as part of so many of their names.↩︎

  3. Note that rm deletes the file. It doesn’t send it to the recycling. This wasn’t immediately obvious to me, resulting in somewhat expected anguish. In Linux the command is gio trash works to move things to the recycling bin.↩︎

  4. Statistics Required…↩︎