Remember you can get help with any UNIX command with man <command>
.
Most Linuxes ship with the bash
shell.
~
is your home directory (E.g./home/bud
)..
is the directory above the current one.
is the current directory*
is every file in the current directory
You can combine these, for example ../*
is every file in the directory above this one.
You can use this to perform bulk actions on files, for example to move everything in this directory into the one below: mv * ../
- Pressing TAB will try to autocomplete the command, path or filename you are typing.
- Pressing ^C (Ctrl + C) will clear the current command you are typing.
- Pressing ^D will log out of the shell.
- Pressing ^L will clear the shell scrollback.
- Pressing ^Z will put the current command in the background and...
- ...Typing %1 and pressing enter will bring the first backgrounded command to the foreground again.
Linuxes ship with a bunch of useful programs in the /bin
, /usr/bin
, /sbin
and /usr/sbin
directories. Here are a few useful ones.
ls <path>
- List contents of current (or specified) directorycd <path>
- Move to the specified directorynano <path>
- Edits a filecp <source>
- Copies a filemv <source>
- Moves a filerm <path>
- Removes a filecat <path>
- Show the contents of a filepwd
- Show me where I am right nowstat <path>
- Show the properties (permissions, etc) of a filedu <path>
- Show the disk space consumed by a file
apropos <something>
- Search manual pages, describe what something is, does or meansman <command>
- Show the manual page for a commandwhich <binary>
- Search your$PATH
directories for a binary, telling you where it is
ping <ip/domain>
- Sends ICMP packets and awaits replies, displays statisticstraceroute <ip/domain>
- Shows the route to a target IP or domaindig <domain>
- Performs a DNS lookup for the specified domainifconfig
- Displays the configuration of the machine's network interfaceswget <URL>
- Downloads the specified URL and saves it as a file in the current directoryssh <user>@<ip/domain>
- Open a Secure Shell session as a user at an IP or domain
Every program running on a Linux system is a process. You can control processes by sending them signals.
ps aux
- Shows a list ofa
ll processes, including theiru
sernames, including ones that are background processes (x
).kill -9 <processid>
- Sends theSIGKILL
(9
) signal to processid.killall -9 <processname>
- Sends theSIGKILL
(9
) signal to all processes named processname.free
(memory_pressure
on Mac OS X) - Shows the current memory usage.
Have a look at the manual pages before using!
sudo <command>
- Super User DO Run a command as the superuser, withroot
's privilegessu
- Become the superusershutdown
- Shuts the system down