Skip to content

Instantly share code, notes, and snippets.

@sleibrock
Last active October 11, 2016 21:49
Show Gist options
  • Save sleibrock/d410af4b59de468f8d4c586d3b871a3a to your computer and use it in GitHub Desktop.
Save sleibrock/d410af4b59de468f8d4c586d3b871a3a to your computer and use it in GitHub Desktop.
Linux Starters Guide

GNU/Linux Command Reference

Terms and Basics

UNIX = system designed at Bell Labs, created by Dennis Ritchie

Linux = derivative of UNIX, created by Linus Torvalds

Dennis Ritchie = creator of UNIX, C programming language, hero to us all

Linus Torvalds = chief designer of Linux, creator of Git version control

Richard Stallman = advocate of GNU Linux, founder of FSF, creator of Emacs

Bjarne Stroustrup = the creator of the C++ language

How to Start Being a Linux Geek

Be prepared to read a lot. A manpage is basically an instruction book on how to use a certain command. If you need more info about some commands, just man the command.

  • man - read the manpage of a given command (man cat)
  • which - print the path of an executable (which gcc -> /usr/bin/gcc)

Files, Directories, Basics

  • ls - list files (ls /home)
  • cd - choose directory (cd /home)
  • cat - output the contents of a file (cat hello.txt)
  • touch - touch a file to modify it's timestamp (and make it exist) (touch hello.txt)
  • nano - open up a text editor to modify a given file (nano hello.txt)
  • pwd - print your current working directory (pwd -> /home/myname/somedir)
  • less - read the contents of a file in a friendly scrollable manner
  • more - opposite of more
  • find - find a file amongst a given directory
  • rm - remove a file or directory
  • cal - print out a calendar
  • date - print out current date/time (lots of options)
  • echo - print something out to standard input

Manipulating Text Streams

  • wc - count the lines, chars and words of a file
  • read - read a line of standard input
  • tee - copy a line of input to given files
  • grep - filter lines based on a given pattern
  • sed - transform and manipulate text streams
  • awk - similar to sed, but more programming-like

Programmer Basic Tools

  • sh - the standard "shell" environment program, executes shell files
  • bash - the Bourne Again Shell (BASh), basically sh++, default shell for all Linuxes
  • expr - evaluate basic arithmetic expressions (expr 2+2 -> 4)
  • gcc - the GNU C Compiler, compiles a C program file to a binary
  • g++ - the GNU C++ Compiler, same as gcc but does C++ programs
  • ssh - create a secure connection to a host (ssh [email protected])
  • python - friendliest language out there, learn it
  • git - tool for version control database
  • sleep - take a nap for N seconds, zzz....
  • alias - bind commands to names to avoid repeating yourself
  • make - very common build system utility to build projects using Makefiles
  • vi, vim - programmer's choice text editor
  • emacs - Richard Stallman's choice text editor
  • sqlite - barebones SQL database program, can read SQL files and manipulate them

Dumb Stuff like Users, Groups and Permissions

  • chmod - change the "mode" of a file
  • chown - change the owner of a file
  • useradd, usermod, userdel - take a guess
  • groupadd, groupmod, groupdel - take another guess
  • users - prints users logged into host
  • groups - prints groups you belong to
  • passwd - changes your password on the system (please remember it if you change it)

Zips, Tarballs, Gzip

  • tar - the most default archiving utility on Linux
  • zip - bare-bones compression, compresses multiple files/dirs into one "zip" file
  • gzip, gunzip, zcat - much better compression algorithm

Network-Related Actions

  • ping - send an ICMP packet repeatedly to an address and return info
  • wget - fetch a resource at a specified destination (wget google.com)
  • wifi - toggle wifi-hardware on your device
  • ifconfig - manipulate your network devices
  • iptables - mess with this and soon your internet will go out
  • traceroute - trace a packet route to a target host (try traceroute 4.2.2.2)
  • nmap - networking Swiss Army Knife - scan open ports, see MAC IDs, etc

System-Level Stuff

  • sudo - elevate yourself to Admin-level privileges
  • su - run command with a different user ID, or log into root shell
  • ps - lists processes running (ps aux will list all procs running)
  • dmesg - see kernel-level messages (try using "less dmesg")
  • gdb - low-level debugger for any program
  • strace - see OS calls made by a program
  • bg, fg - run jobs in backgrounds or bring them to the foreground
  • kill - kill a process by it's PID
  • killall - kill all procs with the given name (killall firefox)
  • top - monitor the status of all running programs
  • htop - a much better to look at 'top'
  • env - a user-created "environment" of custom variables
  • write - write messages to other users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment