Useful Linux Commands for the Lab
9/07/2017 - Optimized for Firefox 55.0.3
cd = change directory
chmod = change access modes on files (and directories)
cp = copy files
clear = clear screen
df = show disk space
dmsg = A FreeBSD command to peruse the contents of the System Message
Buffer that have accumulated since the last reboot. Use to debug
boot problems - typically: dmsgq | less
du = show disk usage
env = show environmental variables
ethtool = Display or change ethernet card settings
find = find . / -name "filename.suffix" -print > /find-output.log
grep = filters out or in, specified strings - usually used with the pipe "|". ls -alF | grep -i myfile
ifconfig = manage Network Intraces (list IP addr, etc)
info = GNUs version of the man pages for GNU software - can be extensive. info ls
insmod ModuleName = install loadable kernel module
kill -9 pid# = kills the specified process (usually)
ls -alF = lists all files in the working directory (the PWD)
lsmod = List loaded modules
lspci = Lists hardware using the PCI bus
lspcmia = Lists devices using the PCMIA bus
lsusb = Lists USB devices
man command-name = displays info about specfied command; use q to exit.
mkfs = make file system
modinfo = does what it sounds like
modprobe -r ModuleName = (Same as rmmod ModuleName)
ps -ef = List all running processes. ps -ef | grep -i myprocess
pwd = list the directory in which you are currently working
rmmode = removes the specified module or modules
ssh = secure shell to remote host
su = become superuser or some other user ("su dave")
tee = Simultaneously store output in file and send to screen
uname -a = list Host Name, OS, version and other info
useradd = users
view = invokes vi in read-only mode; use to read ASCII files.
whereis = shows what path contains the module (if the module's DIR is in your path)
that you would be executing. If you have 3 different versions of the
same command in you path, whereis shows you which one will be executed.
whoami = whom are you logged in as
Special Parameters & Optionsnohup = Start a background job that will continue after you logout/disconnect
& - run in the background, if the first character of the command
| = pipe - used to feed output of one command into another command
LINUX DIRECTORY STRUCTURESLinux's directory structure - tuxfiles.org
/boot/ - Linux keeps information that it needs when booting up
/etc/ - The configuration files for the Linux system. Most of these files are text files
/home/ - This is where users keep their personal files. Every user has their own directory under /home,
and usually it's the only place where normal users are allowed to write files.
/lib/ - The shared libraries for programs that are dynamically linked. The shared libraries
are similar to DLL's on Windows.
/mnt/ - This directory is used for mount points. The different physical storage devices (like
the hard disk drives, floppies, CD-ROM's) must be attached to some directory in the
file system tree before they can be accessed.
/proc/ - This is a special directory. Well, actually /proc is just a virtual directory, because
it doesn't exist at all! It contains some info about the kernel itself. There's a
bunch of numbered entries that correspond to all processes running on the system,
and there are also named entries that permit access to the current configuration of
the system. Many of these entries can be viewed.
/root/ - The superuser's (root's) home directory.
/sbin/ - Most system administration programs are stored in these directories. In many cases you must run
these programs as the root user.
/usr/ - This directory contains user applications and a variety of other things for them, like their source codes,
and pictures, docs, or config files they use. /usr is the largest directory on a Linux system,
and some people like to have it on a separate partition.
/usr/doc/ - Documentation for the user apps, in many file formats.
/usr/include/ - Header files for the C compiler.
/usr/local/ - This is where you install apps and other files for use on the local machine (only)
If you find interesting apps that aren't officially a part of your distro, you
should install them in /usr/local.
/usr/sbin/ - Most system administration programs are stored in these directories. In many cases you must run these
programs as the root user.
/usr/share/ - Config files and graphics for many user apps
/usr/src/ - Source code files for the system's software, including the Linux kernel.
/usr/X11R6 - The X Window System and things for it. The subdirectories under /usr/X11R6 may contain some X
related stuff - dics, headers, configs,...
/var/ - This directory contains variable data that changes constantly when the system is running
/var/log/ - A directory that contains system log files
/var/mail/ - Incoming and outgoing mail is stored in this directory
/var/spool/ - This directory holds files that are queued for some process, like printing
LINUX SYSTEM FILES
/etc/fstab - This file contains descriptive information about the various file systems and their mount points.
/etc/inittab - A text file that describes what processes are started at system bootup and during normal operation.
/etc/exports - permantly exports specified files to other systems - can set permissions
dig - dig (domain information groper) is a flexible tool for interrogating DNS name servers.
It performs DNS lookups and displays the answers that are returned.
dig(1) - Linux man page
Check your DNS records with dig - Linux.com
nslookup - online web tool to lookup and find IP address information in the DNS (Domain Name System)
nslookup - kloth.net
ADDING a HARD DISK
1. Install new disk hardware
2. partition the new disk
3. Create the file systems on the new disk
4. Mount the file systems
See also Linux(click here)
UNIX / LINUX AND VARIANTS