Exam Cards Flashcards
/bin
/bin is a standard subdirectory of the root directory in Unix-like operating systems that contains the executable (i.e., ready to run) programs that must be available in order to attain minimal functionality for the purposes of booting (i.e., starting) and repairing a system. In addition to /bin, some of the other standard subdirectories in the root directory include /boot, /dev, /etc, /home, /mnt, /usr, /proc and /var. Among the contents of /bin are the shells (e.g., bash and csh), ls, grep, tar, kill, echo, ps, cp, mv, rm, cat, gzip, ping, su and the vi text editor. These programs can be used by both the root user (i.e., the administrative user) and ordinary users. /bin is by default in PATH, which is the list of directories that the system searches for the corresponding program when a command is issued. This means that any executable file (i.e., runnable program) in /bin can be run just by entering the file name at the command line and then pressing the ENTER key. The contents of PATH can be seen by using the echo command as follows: echo $PATH
root
The root directory, which is designated by a forward slash ( / ), is the top-level directory in the hierarchy of directories (also referred to as the directory tree) on Unix-like operating systems. That is, it is the directory that contains all other directories and their subdirectories as well as all files on the system.
What is a file?
A file is a named collection of related information that appears to the user as a single, contiguous block of data and that is retained in storage (e.g., a hard disk drive or a floppy disk).
What is a directory in Unix?
A directory in a Unix-like operating system is merely a special type of file that contains a list of the names of objects (i.e., files, links and directories) that appear to the user to be in it along with the corresponding inodes for each object.
Inode
An inode is a data structure on a filesystem that stores all the information about a filesystem object except its name and its actual data. A data structure is a way of storing data so that it can be used efficiently.
Filesystem
A filesystem is the hierarchy of directories that is used to organize files on a computer system.
/sbin
contains additional programs to /bin that are used to boot the system as well as administrative and system maintenance programs that are only available to the root user.
/usr/bin
contains executable programs that are not required for booting or repairing the system.
/etc
Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages. This is the nerve center of your system, it contains all system related configuration files in here or in its sub-directories. A “configuration file” is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary. Examples: /etc/hosts.[allow, deny]: you can control access to your network by using these files. Adds hosts that you want to grant access to your network to the hosts.allow file; add hosts that you want to deny access to hosts.deny. /etc/ftpusers: this file contains the login names of users who are not allowed to log in by way of FTP. For security reasons, it is recommended to add the root user to this file. /etc/inittab: this file describes what takes place or which processes are started at bootup or at different runlevels. A runlevel is defined as the state in which the Linux box currently is in. Linux has seven runlevels, from 0-6. /etc/passwd: this file contains user information. Whenever a new user is added, an entry is added to this file containing the user’s login name, password and so on. This file is readable by everyone on the system. If the password field contains “x”, then encrypted passwords are stored in /etc/shadow, a file that is accessible only by the root user. /etc/profile: when a user logs in, a number of configuration files are executed, including /etc/profile. This file contains settings and global startup information for the bash shell. /etc/shells: this file contains the names of all the shells installed on the system, along with their full path names.
/usr/include
This is where all of the system’s general-use include files for the C programming language should be placed. The directory for ‘header files’, needed for compiling user space source code.
/usr/lib
The /usr/lib directory contains more libraries and data files used by various UNIX commands. UNIX program libraries
/var/log
Log files from the system and various programs/services, especially login (/var/log/wtmp, which logs all logins and logouts into the system) and syslog (/var/log/messages, where all kernel and system program message are usually stored). Files in /var/log can often grow indefinitely, and may require cleaning at regular intervals. Something that is now normally managed via log rotation utilities such as ‘logrotate’. This utility also allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size. Normally, logrotate runs as a daily cron job. This is a good place to start troubleshooting general technical problems
/var
Variable sized files - can grow and shrink dynamically, such a users mail spool and print spool files.
/
the root directory
.
current directory
..
parent directory
~
home directory (tilde)
ls
The ls command is used to list the contents of a directory. It is probably the most commonly used Linux command.
ls -l
List information about the FILEs (the current directory by default) in long format.
ls -la ..
List all files (even ones with names beginning with a period character, which are normally hidden) in the parent of the working directory in long format
$*
The variable $*, is similar to $@, but does not preserve any whitespace, and quoting, so “File with spaces” becomes “File” “with” “spaces”.
$?
this contains the exit value of the last run command Exit status is a numerical value returned by every command upon its completion. As a rule, most commands return an exit status of 0 if they were successful, and 1 if they were unsuccessful.
$#
$# is the number of parameters the script was called with.
$$
The $$ variable is the PID (Process IDentifier) of the currently running shell. This can be useful for creating temporary files, such as /tmp/my-script.$$ which is useful if many instances of the script could be run at the same time, and they all need their own temporary files.



#include

