Useful Unix commands

emacs

Use these commands when inside the emacs editor. ctrl stands for the Control key. esc stands for the Escape key.

A hyphen indicates that the second key should be pressed while holding the first.

Command What it does
ctrl-a Move cursor to beginning of line
ctrl-e Move cursor to end of line
ctrl-k Cut line (like cut and paste)
ctrl-y Paste text
ctrl-x [ Move cursor to beginning of file
ctrl-x ] Move cursor to end of file
ctrl-v Scroll down one screenful
esc v Scroll up one screenful
ctrl-x-c Save current file and exit emacs
ctrl-x-s Save current file without exiting emacs
ctrl-g Cancel current command
ctrl-space Start highlighting text
ctrl-w Cut highlighted text and end highlighting
delete Ends highlighting without cutting text
esc-m Copy highlighted text
ctrl-y Paste whatever's cut or copied

Unix

Type these commands into the terminal, except for tab - for that, just press the Tab key.

Command What it does
clear Clear terminal screen
ls Lists all files in directory
cd Returns to root directory
cd directory_name Enters folder named directory_name
cd .. Goes back one directory
pwd Shows current file path
java Test.java > test.txt Puts output of Test.java into test.txt
man command_name Gives manual page for terminal command command_name
q Exits manual page
tab Autocompletes a half-typed filename or lists available files if pressed twice

SSH

Type these commands into the terminal when you're logged on to your SSH account.

Command What it does
logout Log out of current SSH session