The Linux Command Line

if anyone is completely new & likes videos these seem decent


My number one command line recommendation is to switch to (or just check out Fish shell instead of the default bash or zsh). On a Mac you can install it with brew (what, you don’t have brew? )

brew install fish

Then run it by typing fish . If you love it, there’s a simple instruction to make it permanent. Otherwise just close your terminal or type exit and return to get back to bash/zsh.

Fish does auto completion automatically, suggests recent commands, has a nice prompt and web interface to change your theme, and other great defaults.

That and tldr , already mentioned above twice, will jumpstart your command line abilities, they’re super powers.


this was great ! start here, I’m already feeling comfortable

I also found this -> & learned a few extra things

very nice, set as default : )


cheat :rainbow: sheets

vim -

git -

github cli -


Anyone here prefer terminal emulation within emacs to standalone terminal emulators?

While I usually only occasion to use a Linux terminal straight-up when first getting something set up to run headless, for instance (and generally use vanilla VIM, TMUX, and ZSH in such instances), I’ve mostly used terminal emulation over the years (and still mostly rely on it when using Windows Subsystem for Linux). Lately, though, I’ve been given to doing everything in Emacs (in evil-mode, of course), to include using ANSI-term therein as my terminal emulator. It used to be that it was kind of irritating how the theme never quite rendered correctly, since there was some sort of a clash between my use of Spacemacs’ default theme and the characters of the Agnoster theme through ohmyzsh, but then I found out that most problems I had been experiencing with Spacemacs could be resolved by using the development branch in lieu of the production branch (to include the minor issue mentioned, though there are some a few parts of the theme that spacemacs still overrides, however acceptably).

Anyway, I’ve found terminal emulation within emacs exceedingly helpful since starting to use linux on a chromebook, as my experience of its terminal emulation has been less than satisfactory (owed to a perpetually misaligned cursor, for one thing). Apart from that, I’ve occasioned to use the CLI version of spacemacs in Termux, which is pretty handy at times (mostly for interacting with Org documents), though I’ve got to get a better grasp of Termux’s file management, mounting cloud storage, and so on to make it more useful as a linux environment on the go. I’ve also had a mind to set up a system using spacemacs as the sole window manager like so:

The only major issue I’ve had so far with terminal emulation in emacs is that ORCA-C’s interface pretty much falls apart if I attempt to use it in that way (as I imagine other CLI programs with actual interfaces might, as well; or at least I can’t imagine something like htop works any better and believe that to have been my past experience), so I still rely on terminal emulation for such things.

1 Like

May be of interest to this community, a great blog post on Modular Synthesis and UNIX ! And specifically it’s not about software for modular synth users but on metaphors to relate small unix/Linux commands to different kinds of modules.


This is the cheatsheet I made for myself, maybe that could help someone.


ls List files in the directory
cd Change directory
rm Remove file or directory(-r)
cp Copy file or directory(-r)
mv Move file or directory
wc Count words in file
man Read the manual
cat Reads content of files sequentially
mkdir Make new directory
date Show system date
grep Searches text for matches of a regular expression
tail Displays the tail end of a file or data


ls > foo Send output from ls into file foo
wc < foo Receive input from file foo into wc
ls | wc Connect output of ls into input of wc


-a All, Append -n Number
-b Buffer, Batch -o Output
-c Command, Check -p Port
-d Debug, Delete, Directory -q Quiet, Quit
-e Execute, Edit -r Recurse
-f File, Force -s Silent
-g Group -t Tag
-h Headers, Help -u User
-i Interactive -v Verbose, Version
-j -w Width
-k Keep -x Extract
-l List -y Yes
-m Message -z

One of the most useful command line tricks I have ever learned was how to background and foreground programs. If you are running something like vim in the terminal you can press ctrl-z to send it to the background and get you command prompt back. You can then run the fg command to bring it back. Super useful if you are editing a bit of code and want to test it out without opening a new window or quitting out of you text editor.


You can also fire off things to run in the background by adding an ampersand & to the end of your set of commands (piped or otherwise), it will return a PID + job number and will also report when that PID completes/fails/whatever… Also, fg accepts job number as an argument if you have more than one thing backgrounded.

I actually use the vimium extension in chrome so I can use vim shortcuts to browse, great for browsing when i’m on the laptop on the couch and don’t want to use the touchpad.


I found that putting together small bash scripts to solve small problems makes a cool (executable) library of commands along with real world examples of how to use them…


I’ve got a bunch of 24-bit WAV files I need to convert into 16-bit. Here’s a command I ended up with:
find . -name '*.wav' -type f -print0 | xargs -0 -t -r -I {} sox {} -r 44100 -b 16 {}
It got so close to working but since I’m saving the files with the same name they all got corrupted. How could I fix this? It probably makes most sense to move them into a different directory.
Thanks in advance

1 Like

One-liners are amazing, however I never use them. I find it much easier to make “real” code, it’s easier to get working, it’s easier to maintain…

tmp=$(mktemp /tmp/tmp.XXXX.wav)
for i in `find . -name '*.wav' -type f`; do
    sox $i -r44100 -b16 $tmp
    mv $tmp $i

Julia Evans (@b0rk on twitter) has some great command line tips in the form of comics on her site:


people are all over find lately but I find piping ls through grep easier to remember – you can replace the whole find bit with ls | grep -e wav$ if all the files are in the directory you’re working in (ie not a subdirectory). ls lists all the files in the working directory, grep -e filters the input by a regular expression (you might also have egrep available which does the same), wav$ is a regular expression which matches any file or folder ending in wav

I was just trying to match the @john-smith example as close as possible.

As you mention ls is local, find is recursive…

oh yeah, didn’t mean that as a criticism, just another way of doing things

[edit: that said, I should really just get around to internalizing the find flags…]

Check this out:

find | grep wav$


ls | grep wav$

No need for -e! find and ls to me are equally easy to remember (in basic forms), but are both useful in different situations…

1 Like

semi related to find but not much else— i recently discovered fzf, super helpful

1 Like

Thanks for putting that together — it was largely the fact that I needed to create temporary files that was throwing me off :slight_smile:

The reason for find is its ability to make complex decisions as it traverses a file system tree; Find is not just a “set of flags” but an ordered set of instructions on how to search that tree, including which nodes to enumerate and which branches to cull (this is why the man/info pages are so extensive). Ls only has as much power to traverse as shell globbing affords, and no ability to arrest traversal. Using find where a shell glob would work is unnecessary, but shell globs and ls are in no sense a replacement for find.