How-to: Favourite Linux Command Lines

I constantly moan about Linux users either diving right into, or worse, being forced into, terminal sessions with command line interfaces. Why, with the plethora of graphical user interfaces from which to choose, would you want to do that?

Erm, because sometimes it's quicker and you're not mediated (translation: obstructed) by a poor file manager and search. Honestly, not all terminal commands are bad. Dangerous, sometimes, but not bad. Remember command lines don't kill computers, people do.

Some of the terminal commands I use frequently - with parameters in place of anything between the{} - are:

File Operations
  • cd {directory} –  changes path to the specified folder. Navigate around your drive.
  • ls – list the content of the current folder. See what's on there.
  • pwd – shows your current location on the file tree. Just in case you lose your bearings.
  • mkdir {directory} – creates a new folder (directory). Make new places to put stuff.
  • cp –r – {directory} copies a file or folder (directory). First step to moving things around.
  • rm –r – {directory} removes  a file or (directory). Be careful now.
  • df – shows information about disk usage. How much space haive I used / have left?

Network Operations
  • ping {host} – sends a network ping to the specified address, testing for response and answer time.
  • whois {domain} – shows the whois information about the specified network domain
  • whoami – shows information about the current user.
  • wget {pathtofile} –  downloads a file from the internet.
  • iwlist scan – scans for available wireless networks.
  • smbtree – shows the available Windows network shares (Samba shares).
  • ifconfig – configures TCP/IP network interfaces.

General Utility
  • locate -r 'file*.txt' – this is our 'find' command; searches the index for all entries matching the string file*.txt. Very useful with wild-card matching, using * or ? as substitues for strings or characters.
  • sudo {command} – escalates privileges of the specified to administrator level - for making system-wide changes.
  • sudo apt-get install {packagename} – downloads and installs the specified package.
  • lpq – displays the current print queue.
  • tar -zxvf {archive.tar.gz} –  extract (decompress) the specified .tar.gz archive.
  • apropos {subject} – lists the manual pages for the specified subject
  • man {command} –  displays the manual pages describing usage for the specified command
  • uptime – shows how   much time has passed since the last restart
  • uname -a – displays all information about the current kernel (name, version, release date, hardware)

Remember you can use also Help -- to get a list of keywords for which help topics are available or help {keyword} to get the usage information. RC