Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
Last active December 18, 2015 21:33
Show Gist options
  • Save isomorphisms/836b1a30896fb365ff12 to your computer and use it in GitHub Desktop.
Save isomorphisms/836b1a30896fb365ff12 to your computer and use it in GitHub Desktop.
What should go in a modern beginner's Linux tutorial?

If, at any time, somebody says "X is hard to remember": alias.

Always show the command in the most useful 1-3 contexts, with the most usual flags.

######Assuming Ubuntu:

basics

  • opening a terminal, echo, rev, tac
  • computers can do things we can't: factor 345354699
  • where's my stuff? find ~/Downloads -name "*Frozen*mp4"
  • what's running? ps aux | grep chromium, htop
  • stopping/pausing things: ctrl+C, ctrl+D, ctrl+Z, jobs, fg
  • killall firefox, xkill, kill -9 process.id.you.looked.up

more basics

  • date, cal
  • tr, sed (simple examples)
  • w3m gawker.com #no ads = comments
  • ctrl+R, ctrl+W, ctrl+A, ctrl+E, alt+F, alt+B
  • ctrl+shift+V, ctrl+shift+C
  • !!, !$, alt+., tab
  • \n, \t
  • crontab -e

not useful, but let's show the computer can do some things I can’t:

  • seq 111 151 | factor
  • seq 12211 12251 | factor
  • seq 1225511 1225551 | factor
  • how long does it take for things to get slow? seq 11111111111111111 11111111111111151 | factor

advanced basics

  • sudo service status-all (mysqld, X) : background processes
  • nc : open one connection, listen = interprocess communication (kernel)
  • (maybe a niftier example? eg have nc factor whatever number the other side inputs?)
  • history | grep find (what's the syntax for that find command again?)
  • eog image.jpeg & = backgrounding
  • pdftotext, OCR, …
  • gedit /etc/some.config.file.rc & = backgrounding, text files let you customise your system

installing new things

  • apt-cache search games
  • apt-cache search games | grep chess = pipes, grep
  • sudo apt-get install __ = whatever they want

the internet ≠ the WWW

  • curl, httpbin.org
  • ssh, ssh [email protected], ssh -i secuity.pem -c blowfish [email protected]
  • curl checkip.amazonaws.com
  • ping google.com = simpler message than HTTP or curl
  • traceroute google.com = where the internet goes physically
  • traceroute 127.0.0.1 = right here
  • traceroute 10.0.0.1 = your wireless server
  • traceroute 192.168.1.1
  • some SimpleHTTPServer locally (nc again? echo "boo" | cat | nc -v -l 12345, then navigate to 127.0.0.1:12345 and localhost:12345)
  • post a form with curl -F? = how spam works

exploring the linux filesystem

  • ls /, ls /usr/bin/, ls /usr/local/bin, ls /usr/sbin/, ls /usr/bin/, ls /proc, ls /dev
  • ls -R ~/.config/

installing and running stuff

  • gem install bro = people can write tools for you in python, ruby, perl, as well as c—and you don't have to care which one.
  • bro tar
  • sudo apt-get install build-tools
  • cd /opt && wget http://place.org/files/something.tar.gz && tar -xzvf something.tar.gz && cd something && ls -oh && ./configure && make && make install
  • wget TTYtter.perl; ls -oh; chmod u+x TTYtter.perl; ls -oh; perl TTYtter.perl
  • man sprintf = built on C

This is open-source = chaotic, sometimes anachronistic: tape archives, pseudo-tty's, \bells, ports; curses, bootloaders, nroff, alpine. Linux was written in C because it was an easy language at the time. (Even physicists could learn it.) It predates screens/monitors.

advanced & extras

  • wicd-curses, ifconfig
  • sed, grep, tr. Unix for poets. (And another thing computers are way better at than people.)
  • pip install csvkit
  • first few hg commands (init, add, commit, commit, view tree, commit, undo, un-undo, share w/ colleagues, track their changes)
  • Broman's "minimal make" = idea of reproducibility
  • upload static site to S3 (s3cmd)
  • backup to glacier
  • ELK
  • ruby koans (test-driven development), @dancow tutorial on webscraping
  • databases, csv's, JSON
  • jq api.forecast.io
  • curl quandl
  • tmux / screen
  • xargs
  • dd, shred
  • export, set
  • nohup, sigint, sigkill, trap
  • ctrl+shift+U, gucharmap
  • https://github.com/jlevy/the-art-of-command-line

######Assuming Mac:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment