Unix/Linux: Basics
What are the rules for naming files?
- It cannot contain a / - Characters: . + and - can be used without problem so long as they don't begin the filename - A-Z a-z 0-9 and _ are always fine
What are the two ways to combine multiple options in a Linux command?
-OptionOptionOption...Option or - Option -Option Option
What do the dot commands (. and ..) mean?
./pathname: useful as a shortcut in writing the current directory cd .. is a shortcut in moving back to the parent directory
Directories and file names in a pathname are separated by a _______
/
With regards to file trees, Unix has ____ and organizes itself into a _____
A single filesystem tree hierarchical directory structure
/usr directory
Aside from the root directory, this is the largest directory tree in the system. It contains all the program and support files for the usr.
Absolute pathname
Begins with the root directory and follows the tree branch by branch until the path to the desired directory or file is completed.
/boot directory
Contains everything needed for booting the system such as: the linux kernel, RAM disk image, and the boot loader.
/opt directory
Contains optional add-on software for installation that is not installed by default on the system.
/tmp directory
Contains temporary files created by various programs. Generally cleared on reboot.
/etc directory
Contains the system configuration files.
/var directory
Contains variable data files. These are files to which the system writes during operation.
Keyboard Shortcut: ^a
Ctrl a Moves cursor to beginning of the line of text
Keyboard Shortcut: ^d
Ctrl d Deletes the character at the location of the cursor
Keyboard Shortcut: ^ k
Ctrl k Cuts all text from the position of the cursor to the end of the line.
Keyboard Shortcut: ^ l
Ctrl l Clears the shell. Basically the same as the clear command.
Keyboard Shortcut: ^e
Ctrl r Moves the cursor to the end of the line of text
Keyboard Shortcut: ^ u
Ctrl u Cuts all text from the position of the cursor to the beginning of the line.
Keyboard Shortcut: ^y
Ctrl y Returns cut text from ctrl k or ctrl u
Left and right keyboard keys do what in the shell?
Move left and right across the prompt. Useful for editing commands
Keyboard Shortcut: alt b
Moves the cursor backward by one word.
Keyboard Shortcut: alt f
Moves the cursor forward by one word
Most Linux commands take the form of:
Options modify the original command. The argument is what you're working with for the command.
/bin directory
Short for binary directory. Contains binary files that allow commands to be used within the shell.
/sbin directory
Short for system binary directory
Relative pathname
Starts from the working directory
Root Directory: /
The first directory in the filesystem.
What is the command history and how do you move through it in the shell?
The history of previous and successive commands you have made at the shell prompt. Scroll back and forward with the up and down keyboard keys respectively.
Unix Shell Prompt
Usually of the form: username@machinename Usually ending in a $, but may also end in a # if you are the superuser.
Bourne Again Shell
aka, BASH. It is an enhanced version of sh (the original shell program).
/home directory
also known as the login directory. It contains the home subdirectories for each user of the system. Within each, there can be all kinds of files and directories for each user.
With regards to being case sensitive: unit filenames are ____
case-sensitive.
In Linux, files ______
do not have extensions.
If a filename begins with a dot (.) then _____
it is a hidden file.
When the terminal is first started we're in _____
our home directory
Every directory has a _____
parent directory, even root (it refers back to itself).