Tips for Linux Installation/Configuration/Use

Linux directory structure

Directory

Description

/

Primary hierarchy root and root directory of the entire file system hierarchy.

/bin/

Essential command binaries that need to be available in single user mode; for all users, e.g., cat, ls, cp.

/boot/

Boot loader files, e.g., kernels, initrd; often a separate partition.

/dev/

Essential device interfaces.

/etc/

Host-specific system-wide configuration files (the name comes from et cetera).

/etc/profile/

Configuration files for the shell, e.g., Bash.

/etc/X11/

Configuration files for the X Window System, version 11. xorg.conf lives here.

/etc/ssh/

Configuration files for SSH remote access.

/etc/rc.d/

Configuration files for system startup.

/etc/opt/

Configuration files for /opt/.

/home/

Users' home directories containing saved files, personal settings, etc.; often a separate partition.

/lib/

Libraries essential for the binaries in /bin/ and /sbin/.

/media/

Mount points for removable media such as CD-ROMs.

/mnt/

Temporarily mounted filesystems.

/opt/

Optional application software.

/proc/

Virtual filesystem documenting kernel and process status as text files, e.g., uptime. In Linux, corresponds to a procfs mount.

/root/

Home directory for the root user.

/sbin/

Essential system binaries, e.g., init, route, mount.

/srv/

Site-specific data which is served by the system.

/tmp/

Temporary files (see also /var/tmp). Often not preserved between system reboots.

/usr/

Secondary hierarchy for read-only user data; contains the majority of multi-user utilities and applications.

/usr/bin/

Non-essential command binaries (not needed in single user mode); for all users.

/usr/include/

Standard include files.

/usr/lib/

Libraries for the binaries in /usr/bin/ and /usr/sbin/.

/usr/sbin/

Non-essential system binaries, e.g., daemons for various network services.

/usr/share/

Architecture-independent (shared) data.

/usr/src/

Source code, e.g., the kernel source code with its header files.

/usr/X11R6/

X Window System, Version 11, Release 6.

/usr/local/

Tertiary hierarchy for local data, specific to this host. Typically has further subdirectories, e.g., bin/, lib/, share/.

/var/

Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files. Sometimes a separate partition.

/var/lib/

State information. Persistent data modified by programs as they run, e.g., databases, packaging system metadata, etc.

/var/lock/

Lock files. Files keeping track of resources currently in use.

/var/log/

Log files. Various logs.

/var/mail/

Users' mailboxes.

/var/run/

Information about the running system since last boot, e.g., currently logged-in users and running daemons.

/var/spool/

Spool for tasks waiting to be processed, e.g., print queues and unread mail.

/var/spool/mail/

Deprecated location for users' mailboxes.

/var/tmp/

Temporary files to be preserved between reboots.

The above data was adapted from http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard.

Tracing dependencies

ldd <filename>

This produces a list pointing to files that filename is dependent upon. A blank space after a pointer arrow indicates that a crucial file is missing. Google the missing file to see if you can download it.

Reading diagnostics logs

/var/log/Xorg.O.log

This log could contain diagnostics that indicate why startx didn't work. You can Google these to learn more. /var/dmesg and /var/messages also keep ongoing diagnostics journals that may be helpful in trouble-shooting.

SSH

ssh <username>@<hostname>

This command permanently adds the specified host to a list of known hosts and connects you remotely to the host.

scp

scp <username>@<hostname>:<some file on the remote machine> <some file on this machine>

Secure copy. This command copies some file on the remote machine to a location specified on this machine. Also can work the other way:

scp <some local file> <username>@<hostname>:<name at remote machine>

The "-r" option can be used to copy whole directories, as in:

scp mydir user@remote.org:

(leaving off the directory or filename after the ":" will just use the same name). Another thing you can do is use IP addresses instead of a hostname. For instance,

scp mydata.txt user@192.168.42.35:

will copy mydata.txt to the /home/user directory on 192.168.42.35.

xv

xv <filename with extension>

This command opens and displays an image file such as JPEG or GIF over a remote SSH connection. Note: for this to work over an SSH session, you might have to get the "X11 Forwarding" option set up on the SSH client and server.

adduser

It's a good idea to create user accounts. Logging in as a user limits the access you have to system files and thus limits the damage you can do to the system. A # prompt indicates you are logged in as root. A $ prompt indicates you are logged in as a user. addusers starts an interactive form that you fill out to create a new user.

Ctrl + Alt + Backspace

Open a command prompt outside of X Windows This combination, done inside X Windows, should terminate X Windows immediately. If it does not, then something in the /etc/X11/xorg.conf file will have to be changed. Also, even inside of X Windows, you might be able to use Ctrl + Alt + F2 and bring up and native console outside of X Windows, then use Crtl + Alt + F7 to return to X Windows; again, whether this is allowed may depend on the setup in the /etc/X11/xorg.conf file.

su

This command indefinitely switches you from user mode to root mode. To go back to user mode, type exit.

sudo

sudo <command>

sudo runs a single command in root mode and immediately returns to user mode. Note: on many systems, this has to be allowed by an administrator first (if you want to run in root mode without a password); there's a "visudo" command that only the root can do, which uses vi to edit a sudoers file with a strange syntax on allowing users to do sudo commands.

Feb4Notes (last edited 2014-05-25 18:15:49 by localhost)