Skip to main content

You're reading the free online edition of Effective Shell. If you're finding it useful, please consider picking up the print or Kindle edition from No Starch Press or Amazon - or sharing it with someone who'd enjoy it.

index-of-commands

CommandDescription
cd
ls
pwd
mkdir
rm
rmdir
cd
cd
pstree -p $$Show the process tree for the current shell process.
Shell Configuration
shoptSet or unset a shell option.
chshChange the shell for a user.
User Management
useradd -m nameAdd user with the name name. -m creates a home directory name.
passwd nameSet the password for user name.
userdel nameRemove user with the name name.
usermod -aG sudo nameMake name a sudoer.
------------------------------------------------------------------------------------------------------------------------------
Git
git initInitialise a new Git Repository.
git statusShow the status of the working tree and index.
git add <files>Stage files - you can use patterns and wildcards.
git reset <files>Unstage files - you can use patterns and wildcards.
git rm --cached <files>Unstage files - you can use patterns and wildcards.
git commitCreate a commit from the current index - the shell editor will open for the commit message.
git commit -m 'message'Create a commit with message message.
git commit -aStage and commit all changes in the working tree.
git checkout <branch>Checkout a branch called branch.
git checkout -b branchCreate and checkout a new branch called branch.
git branch <name>Create a branch called name but do not check it out.
git branch -m <new_name>Change the current branch name to new_name.
git merge <branch>Merge the branch named branch into the current branch.
git logShow the log of commits.
git log --oneline --branchShow the log of commits, one line per commit, with the branch graph.
git rm <files>Stage the removal of files from the repostiry - you can use patterns and wildcards.
git mv <source> <destination>Stage the movement of source to destination.
git checkout 8342becCheckout a commit with SHA 834bec.
git checkout HEAD~1Move the current HEAD back one commit.
git checkout <branch>~3Checkout branch, move back three commits from the tip.
  • grep
  • mkdir
  • rm
  • rmdir
  • touch
  • cat
  • watch
  • tail
  • head
  • less
  • more
  • most
  • echo
  • timeout
  • until
  • pwd -P (physical, shows symlinks)