Commands and shortcuts
Here's a random selection of commands and shortcuts I've found useful.
Useful unix commands
Use the man
command to see more details on how to call these commands.
- du
- Shows the space used up by the selected directory and its subdirectories
- df
- Shows how much spare disk space is left on each drive
- dmesg
- Shows system messages, useful for spotting hardware events
- ln
- Makes a link or shortcut that points to another file - links can be 'hard' or 'symbolic' (although
the differences are subtle and technical and beyond me - stick to symbolic links which show the destination
file / directory as well with a
ls -l
)
- lspci
- Lists the devices on the system. Usually used with -v for verbose output
- md5sum
- Generates and checks md5 checksums from downloaded files to make sure they
weren't accidentally corrupted. If you haven't got this, use the java MD5 checker tool from the
downloads section.
- modprobe
- Adds a module dynamically to the kernel - see also modinfo for module
information and lsmod to list currently installed modules
- grep
- Very powerful tool for searching files for text. See tips for how to use it.
KDE shortcuts
Here are some key presses which come in handy with KDE - I've no idea whether they work with Gnome or not, and I assume
they're configurable (somewhere...)
- Ctrl-Alt-Backspace
- Restarts X, brings you back to the login screen.
- Ctrl-Alt-Escape
- Brings up the Skull-and-crossbones mouse pointer, use this to click on misbehaving applications
and killllllll them.
- Ctrl-Escape
- Pops up a list of currently running processes and lets you killllllll the naughty ones.
- Ctrl-Alt-K
- Changes the keyboard layout, if you have more than one installed - see the flag icon in the task tray
to see which layout is currently active. Be careful when changing to a layout which doesn't have a 'k', otherwise you may
not be able to change back again!
- Alt-Tab
- As expected, cycles through the currently active applications, let go of Alt to select one
- Ctrl-Tab
- Not as expected, cycles through the currently defined 'desktops' - different views of the currently
running applications. Confusing.
- Alt-F2
- Same as Start -> Run Command...
- Alt-F3
- Brings up the window's control menu in the top left, giving keyboard access to maximise and minimise.
Dangerously close to Alt-F4 (close window).
- Ctrl-Alt-F1 to Ctrl-Alt-F7
- Changes to the numbered terminal. Number 7 is the normal X windows session, all the
others are just full-screen consoles where you can login and do something else, switching back and forward when you want.
So if you press one of them by accident and all your windows disappear, use Ctrl-Alt-F7 to return.
- Alt + left mouse drag
- Moves the active window around the screen (saves going up to drag the title bar).
- Alt + right mouse drag
- Depending which window edge or corner you're near, resizes the window in that direction
(saves going exactly to the window border to drag it).
Bash shortcuts
Here are some simple shortcuts to make repeating previous bash commands easier:
- Up arrow
- Go up to the previous command to edit it and re-execute it. Pressing it multiple times scrolls back through the history to earlier and earlier commands.
- !
- Re-execute the previous command. Doesn't give you chance to check what it was though, so it's safer to use Up arrow and then enter.
- Ctrl-R
- Enter a search mode to search for a previously entered command. Just start typing part of the command you're looking for, and it'll find the most recent match. Press Ctrl-R again to go back to even earlier commands containing the search phrase.