If you’re using Linux, you’re using the command line, and it can seem a little daunting at first. The fact is, you’re not using a “terminal” but a shell program such as bash, which has a wide array of useful command-line capabilities all to itself. Here are some other tools that can help you get your work done from the command line.

vim (or vi)

When it comes to editing files, I like the simplicity of vim. Once you learn a few basics — such as navigating around the screen without a mouse — it can be a powerful tool. Some useful, everyday commands:

  • G — Go to the end of the file
  • gg — Go to the top of the file
  • n G — Go to a specific line in the file. For example, 15 + G
  • cw — Place the cursor at the start of a word and this command will replace it with whatever you type.
  • R — Overwrite text
  • A — Go to the end of a line and start inserting text
  • q! — Quit the file without saving
  • ^ — Go to the beginning of a line
  • $ — Go to the end of a line

scp

When you’re working between two separate Linux hosts, you often need to get files from one to the other. Yes, you could fire up a Python web server, but scp is fast and easy. You can copy single files or whole folders. Here’s the syntax:

From your current host to a remote host:

$ scp <filename> remotehost:/path/to/save/<filename>

From a remote host to your current host and current directory:

$ scp remotehost:/path/to/get/<filename> ./

Copy entire folders:

$ scp -r /path/to/folder remotehost:/path/to/save/it

nmap

Sometimes you just need to know which ports on a remote host are open or even just visible. Using nmap makes it easy:

$ nmap hostname

An example for a host name tux would look like this:

$ nmap tux

Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-27 16:30 EDT
Nmap scan report for tux (10.128.1.40)
Host is up (0.00051s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
3000/tcp open ppp
8000/tcp open http-alt
9090/tcp open zeus-admin
9100/tcp open jetdirect

arp-scan

Similar to nmap, you sometimes need to know the IP addresses of other systems on your network. For example, you boot a Raspberry Pi without a monitor and want to ssh into it and want to know it’s IP address. Arp-scan to the rescue:

$ sudo arp-scan --localnet (for most setups)

Alternatively, you can specify a network (works great if you have bridged connections):

$ sudo arp-scan 192.168.1.0/24