Shad's Essential Linux

With a Gentoo bias... 

Starting and Stopping

shutdown -h now    -    Powerdown the system
shutdown -r 5    -    Reboot the system in 5 minutes

Finding Files and Text Within Files

find /etc -iname '<search string>'    -    Case insensitive search for the search string in the /etc folder
grep <search string> /etc    -   Search for the search string in all files in the folder /etc

File System Commands

ls    -    List all files in the current folder
rm filename    -     Remove the file specified
rm -rf folder    -    Delete an entire folder
cp source dest/    -    Copy the source file to the destination folder
mv filename folder/   -   Move filename to folder
mv file1 file2   -   Rename file1 to file2
ln -s source [dest]    -    Make a symlink to source at dest
cat file    -    View the file
more file    -    Display the file one page at a time
head -20 file    -    Display the the first 20 lines of the file
tail -20 file    -    Display the last 20 lines of the file

Other Commands

man command   -   Manual for the command
apropos query    -    Search the man pages for query
ps    -    List running processes
ps -e   -   List all running processes
top    -    Interactive list running processes
kill pid    -    Kill process with pid
ctrl-z    -    Suspend current operation
bg    -    Put last operation in the background
fg    -    Bring last operation in the background to the foreground
modprobe    -    Add or remove modules 

System Info Commands

dmesg    -    Display the boot log
lspci    -    List of devices in the system
lsmod    -    List of loaded modules

Remote Operations (SSH, SCP)

/etc/init.d/sshd start   -   Starts the SSH server
ssh user@myaddress.com    -    Connect to the SSH server as user at myaddress.com
scp file user@myaddress.com:/~/Desktop    -    Copy the file to the desktop on the server at myaddress.com
scp user@myaddress.com:/~/Desktop/file .   -   Copy a file from the desktop at myaddress.com to the current folder

Using Screen

screen   -   Start a screen session
screen -ls    -    Show current screen sessions
screen -r    -    Resume the last screen session
screen -r pid.tty.host    -    Resume a specific screen session
screen -d -r pid    -    Force resume of a specific screen session detaching any currently attached sessions

While in a screen session precede the following commands by ctrl-a:

?   -   Get help
d   -   Detach from the current session
c   -   Start a new session
"   -   Get a list of available windows currently open
(space)    -    Next session
(number)   -   Go to screen number

User Administration

useradd accountname   -   Create the user accountname
passwd accountname    -    Change the password of user accountname
su    -    Login as super user from the current login
ctrl-d    -    End the current session

Groups, Permissions and Security Commands

chmod 755 myfile    -    Set myfile with (user, group, other) (rwx,rw,rw) access permission
chmod u+w myfile   -   Add write permission for you to myfile
chmod goa-r myfile    -    Remove read permission for myfile from all users except you
chown userme myfile    -    Change the owner of myfile to userme
chown shad:root myfile    -    Change the owner of myfile to userme and the group owner to root
groups    -    Displays the groups that the current user is a member of 
usermod -G wheel,userme userme    -     Makes userme part of the wheel group (may execute su)
    Note: You can also add a user to a group by directly modifying the file /etc/group

Configuration Commands

ifconfig   -   List all interface information (eth0, lo, etc.)
ifconfig eth0 [up|down]   -   Bring eth0 up or down
ifconfig eth0 netmask mask   -   Set the network mask to value for interface eth0
ifconfig eth0 broadcast address   -   Set the broadcast address to value for interface eth0
ifconfig eth0 address    -   Set the ip address for interface eth0
route   -   Print the routing table
route add default gw address   -   Set the default gateway

Configuration Files

/etc/fstab    -    The file system table
/etc/profile    -    Environment variables for all users
/etc/motd    -    Message of the day broadcast to all users at login
/etc/rc.d/rc.local    -    Bash scripts ot be executed after successful logon
/etc/conf.d/hostname    -    Host name file
/etc/conf.d/domainname    -    Domain name file
/etc/hosts   -   A list of all known host names and IP addresses
/etc/resolv.conf   -   List of DNS servers
/etc/X11/XF86Config   -   X-Windows configuration
/etc/X11/xorg.conf    -    Keyboard, mouse, display resolution settings for X11
/etc/rc.conf    -   Startup script for setting display manager (xdm, gdm, kdm) and the xsession (gnome, kde)
/etc/group    -    List of groups and group memberships