Unix 1: Commands, directories, and processes
absolute path
A path to a directory that has a constant startpoint (the root)
relative path
A path to a directory that is in relation to your current location
-rw-r--r--
Access rights to the file Leading dash is regular file, d is a directory. next three are for file owners, next three group rights, next three is everyone else.
ls -F
Appends an indicator character to each listed name.
Pressing tab while entering a directory name
Autofills the directory name up until the names differ
BSD
Berkeley Software Distribution. UC Berkeley's distribution of the Unix operating system. One of the most popular.
sort
Concatenates files based on a designated sort key
ctrl+c
Conrol Break
/bin
Contains binaries (programs) that must be present for the system to boot and run.
/usr/sbin
Contains more system administration programs.
/lib
Contains shared library files used by the core system programs. These are similar to DLLs in Windows.
/boot
Contains the Linux kernel, initial RAM disk image, and the boot loader
cp
Copy files and directories
ln
Create hard and symbolic links
whatis
Display a very brief description of a command
type *command*
Displays the kind of command the shell will execute given the *command*
*command*--help
Displays usage information for the command given. available for many executables.
/lost+found
Each formatted partition or device using a Linux file system, such as ext3, will have this directory. It is used in the case of a partial recovery from a file system corruption event. Unless something really bad has happened to your system, this directory will remain empty.
ps -f
Gives a full format columned listing of processes
/home
In normal configurations, each user is given a directory here. Ordinary users can only write files in these directories. This limitation protects the system from errant user activity.
ls -A
Like the -a option except it does not list . (current directory) and .. (parent directory)
ls -l
List all files and dirctories as well as their creation info
ls -a
List all files and directories including those hidden by a .
ls -S
List all files and directories sorted by file size
ls -lt
List files and directories by date created
who
List users currently logged in
/usr/share/doc
Most packages installed on the system will include some kind of documentation. In this directory, we will find documentation files organized by package.
cd ..
Move up one directory
/media
On modern Linux systems this directory will contain the mount points for removable media such as USB drives, CD-ROMs, etc. that are mounted automatically at insertion.
/mnt
On older Linux systems, this directory contains mount points for removable devices that have been mounted manually.
head
Output the first part of a file
tail
Output the last part of a file
grep
Print lines matching a pattern
wc
Print newline, word, and byte counts for each file
PID #
Process Identification Number
PPID
Process Parent ID. The parent command of the spawned process
vi, :q
Quit the VI editor
tee
Read From Stdin And Output To Stdout And Files
rm
Remove files and directories
ps
Reports a snapshot of current processes
apropos *search term*
Searches the list of man pages for possible matches based on a search term
w
Shows current logged in users
history
Shows prior commands entered
top
Shows system usage. Default is similar to Task Manager
man ls
Shows the manual page for the referenced command
cd !$
Stores the value f the at command in the variable. Thus allowing a cd into a previous mkdir
Less is more
The less command is a more sophisticated version of the more command
/
The root directory
/usr/lib
The shared libraries for the programs in /usr/bin.
/sbin
This directory contains "system" binaries. These are programs that perform vital system tasks that are generally reserved for the superuser
/usr/share
This directory contains all the shared data used by programs in /usr/bin. This includes things like default configuration files, icons, screen backgrounds, sound files, etc.
/var/log
This directory contains log files, records of various system activity. These are very important and should be monitored from time to time. The most useful ones are /var/log/messages and/or /var/log/syslog. Note that for security reasons on some systems, you must be the superuser to view log files.
/tmp
This directory is intended for storage of temporary, transient files created by various programs. Some configurations cause this directory to be emptied each time the system is rebooted.
/proc
This directory is special. It's not a real file system in the sense of files stored on your hard drive. Rather, it is a virtual file system maintained by the Linux kernel. The "files" it contains are peepholes into the kernel itself. The files are readable and will give you a picture of how the kernel sees your computer.
/opt
This directory is used to install "optional" software. This is mainly used to hold commercial software products that may be installed on your system.
/usr
This directory tree is likely the largest one on a Linux system. It contains all the programs and support files used by regular users.
/dev
This is a special directory which contains device nodes. "Everything is a file" also applies to devices. Here is where the kernel maintains a list of all the devices it understands.
/root
This is the home directory for the root account.
/usr/local
This tree is where programs that are not included with your distribution but are intended for systemwide use are installed. Programs compiled from source code are normally installed in /usr/local/bin. On a newly installed Linux system, this tree exists, but it will be empty until the system administrator puts something in it.
alias e.g. alias foo='cd /usr; ls; cd -'
Used to create your own command
chmod
Used to determine permissions to a directory. Based around the number 7. 1 is execute, 2 is write, 4 is read. Adding the numbers gives you the number relevant to the permissions you want.
tar
Utility for collecting many files into one archive file
/var
With the exception of /tmp and /home, the directories we have looked at so far remain relatively static, that is, their contents don't change. This directory tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.
cat
allows the creation of single or multiple files, view contents of a file, concatenate files and redirect the output in terminal or files
cd
change directory
cd ~user_name
changes the working directory to the home directory of user_name.
which
displays an executable's location
df
displays free disk space on your drives
vi :q!
exit the vi editor without saving any changes
ls
list files and directories
mkdir
make directory
mv
move/rename files and directories
pwd
print working directory (Shows where you are)
uniq
report or omit repeated lines
ls -lt --reverse
reverses the order of the sort
free
shows amount of free memory
ls --help
shows information about the ls command. ls can be replaced by any command
/usr/bin
this contains the executable programs installed by your Linux distribution. It is not uncommon for this directory to hold thousands of programs.
/etc
this directory contains all of the system-wide configuration files. It also contains a collection of shell scripts which start each of the system services at boot time. Everything in this directory should be readable text.