10 Linux Terminal Tips and Tricks to Enhance Your Workflow

Are you a Linux user and/or administrator? These 10 terminal tricks will show you some new and exciting ways you can enhance your workflow, shorten longer tasks, and even have a little fun along the way.

YouTube player

Commands used in this video

Simplify package installation

Use the alias command to create custom commands of your own, and feel free to get creative. In the video, an example is shown of simplifying package manager commands. For example, with Debian/Ubuntu:

alias install="sudo apt install"

With that alias in place, you can simply type install in order to install a package:

install tmux

Similarly, you can shorten that same alias down to just a single character:

alias i="sudo apt install"

And then, package management is much easier:

i tmux

Go ahead and create your own. Here’s another one:

alias e=”nano”

And that will shorten the command for your text editor.

In order to keep these aliases around, be sure to add the commands that create them to your ~/.bashrc file, so that way they’re automatically recreated every time you open a terminal.

Checking your weather forecast

Believe it or not, you can check your local weather anytime right from within your terminal:

curl wttr.in

And there you go – you now know what your weather is like without even having to step outside. Check out the project that makes this possible here.

Running an Internet Speed Test (From Your Terminal)

What’s your download and upload speed? This alias will let you know:

speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'

Now you can simply run speedtest anytime to check your Internet speed.

Jay’s custom bash prompt

To use the same bash prompt style as Jay, create the file ~/home/.bash_prompt and place the following inside:

BRACKET_COLOR="\[\033[38;5;35m\]"
CLOCK_COLOR="\[\033[38;5;35m\]"
JOB_COLOR="\[\033[38;5;33m\]"
PATH_COLOR="\[\033[38;5;33m\]"
LINE_BOTTOM="\342\224\200"
LINE_BOTTOM_CORNER="\342\224\224"
LINE_COLOR="\[\033[38;5;248m\]"
LINE_STRAIGHT="\342\224\200"
LINE_UPPER_CORNER="\342\224\214"
END_CHARACTER="|"

tty -s && export PS1="$LINE_COLOR$LINE_UPPER_CORNER$LINE_STRAIGHT$LINE_STRAIGHT$BRACKET_COLOR[$CLOCK_COLOR\t$BRACKET_COLOR]$LINE_COLOR$LINE_STRAIGHT$BRACKET_COLOR[$JOB_COLOR\j$BRACKET_COLOR]$LINE_COLOR$LINE_STRAIGHT$BRACKET_COLOR[\H:\]$PATH_COLOR\w$BRACKET_COLOR]\n$LINE_COLOR$LINE_BOTTOM_CORNER$LINE_STRAIGHT$LINE_BOTTOM$END_CHARACTER\[$(tput sgr0)\] "

Save that file, and then open up your ~/.bashrc and place the following at the end of the file:

source ~/.bash_prompt

The next terminal window you open should use the new prompt.

View Linux command cheat sheets

Viewing man pages might be useful, but cheat sheets are simpler and more to the point. You can view a cheat sheet from cheat.sh by running a command like the following:

curl https://cheat.sh/ls

Replace the command name at the end with the command you want to see information on.

Want more?

Check out the video for even more terminal tips and tricks!

Support Linux Learning