Skip to content

Instantly share code, notes, and snippets.

@knowtheory
Created February 4, 2013 17:33
Show Gist options
  • Select an option

  • Save knowtheory/4708191 to your computer and use it in GitHub Desktop.

Select an option

Save knowtheory/4708191 to your computer and use it in GitHub Desktop.
# <= this hash sign. Hash signs are used to start comments.
# Anything that starts with a hash will be instructions or descriptions.
# Different programming languages/environments will use different
# characters to start comments.
# Bash (what your shell uses, happens to use the hash mark)
# comments run from the hash mark to the end of the line.
# So, one can issue a command, and add a comment after it like so:
ls # this is a command we will explain below
# What the command prompt looks like.
# [your-computers-name]:[the current directory] $ [your commands go here]
# Commands you can run
# If you need to terminate a command that is currently running
# hold down the `control` key and press `c` you'll also see
# this written as `ctrl+c`
# the list command.
# ls [optional directory] # Lists the contents of a directory. If no directory is supplied, it will list the current directory.
# Examples
ls # lists the contents of the current directory
ls .. # lists the contents of the directory one level up
ls ~ # lists the contents of your home directory
ls -a # lists all the contents of the current directory including hidden files
ls -l # shows a detailed list of the contents of your current directory
# cd [target directory] # changes directory to the target
# note that your command prompt updates to reflect which
# directory you are in.
cd ~ # ~ is your home directory, this will take you home.
cd .. # moves up a directory.
cd Pictures # change into the "Pictures" directory
cd /
pwd # print working directory. Tells you what directory you're in.
# man [command name] # the man tool will display the manual for the specified tool, if available. You can use the arrow keys to page up and page down within the manuals. Press "q" to quit a manual.
# Examples
man man
man ls
man cd
# less [a text file]
# less will show you the contents of a text file.
# less is named "less" because there is another program which displays text called "more". So. less is more. :|
less readme.md
# clear
# Clears the current screen
clear # type `ls` a couple times first to see.
# which [command name]
# which will tell you where a command is installed if it exists
# so which can be used to tell you if a command is installed or not.
which git # is git installed? if so, it'll say something like '/usr/bin/git'
# Remove
rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment