Debian Reference
Debian Reference
1.-
_______________
CONSOLE BASICS
VIRTUAL CONSOLES
there are six switchable VT100-like character consoles
switch between the virtual consoles by pressing the Left-Alt-key and one of the F1
— F6 keys simultaneously.
Each character console allows independent login to the account and offers a
multiuser environment.
gain access to the character console 1 by pressing Ctrl-Alt-F1
get back to the X Window System, normally running on the virtual console 7, by
pressing Alt-F7.
alternatively change to another virtual console, e.g. to the console 1, from the
commandline. <mark><b># chvt 1</mark></b>
Shutdown the system under the normal multiuser mode. <mark><b># shutdown -h
now</mark></b>
Alternatively, you may type Ctrl-Alt-Delete
ADDITIONAL PACKAGES
Install packages by <mark><b># aptitude install package_name</mark></b>
SUDO CONFIGURATION
To let the non-privileged user gain administrative privilege. <mark><b># echo
"penguin ALL=(ALL) ALL" >> /etc/sudoers</mark></B>
UNIX-LIKE FILESYSTEM
Files are organized into directories. All files and directories are arranged in one
big tree rooted at "/".
files and directories can be spread out over several devices.
"<mark><b>mount</mark></b>" attach a device filesystem to the big file tree.
Conversely, "<mark><b>umount</mark></b>" detaches it again.
FILESYSTEM PERMISSIONS
USERS...
- The USER who owns the file (u)
- Other users in the GROUP which the file belongs to (g)
- All OTHER users (o) also referred to as "world" and "everyone"
FILE...
- The READ (r) permission allows owner to examine contents of the file.
- The WRITE (w) permission allows owner to modify the file.
- The EXECUTE (x) permission allows owner to run the file as a command.
DIRECTORY...
- The READ (r) permission allows owner to list contents of the directory.
- The WRITE (w) permission allows owner to add or remove files in the directory.
- The EXECUTE (x) permission allows owner to access files in the directory
TIMESTAMPS
TYPE MEANING
mtime the file modification time (ls -l)
ctime the file status change time (ls -lc)
atime the last file access time (ls -lu)
- Overwriting a file changes all of the mtime, ctime, and atime attributes of the
file.
- Changing ownership or permission of a file changes the ctime and atime attributes
of the file.
- Reading a file changes the atime of the file.
LINKS
HARD LINK
Duplicate an existing file using another name
The hardlink can be made within the same filesystem and shares the same inode
number which the <mark><b>-i</mark></b>" reveals
An INODE is a data structure used to represent a filesystem object.
________
SOCKETS
Sockets are used extensively by all the Internet communication, databases, and the
operating system itself.
Allows processes to exchange information even between different computers.
"<mark><b>netstat -an</mark></b>" provides a very useful overview of sockets that
are open on a given system.
______________
DEVICE FILES
Device files refer to physical or virtual devices: hard disk, video card, screen,
keyboard, etc...
EX... "<mark><b>/dev/console</mark></b>".
BLOCK DEVICE
Accessed in larger units called blocks (1 block > 1 byte)
EX... hard disk, . . .
___________________
procfs and sysfs
The procfs and sysfs mounted on "/proc" and "/sys" are the pseudo-filesystem and
expose internal data structures of the kernel to the userspace.
"<mark><b>/proc</mark></b>" contains one subdirectory for each process running on
the system, which is named after the process ID (PID).
"<mark><b>/proc/sys/</mark></b>" contain interface to change certain kernel
parameters at run time.
________________________
MIDNIGHT COMMANDER (MC)
Use the "<mark><b>mc</mark></b>" command to explore the Debian system.
..........
THE INTERNAL EDITOR IN MC
To edit a file from mc run....
"<mark><b>mc -e filename_to_edit</mark></b>"
"<mark><b>mcedit filename_to_edit</mark></b>"
..........
THE INTERNAL VIEWER IN MC
To view and search a file content...
"<mark><b>mc -v path/to/filename_to_view</mark></b>"
"<mark><b>mcview path/to/filename_to_view</mark></b>"
..........
AUTO-START FEATURES OF MC
Press Enter on a file, and the appropriate program handles the content of the file
Viewable files should not be set as executable. Change their status using chmod(1).
..........
FTP VIRTUAL FILESYSTEM OF MC
MC can be used to access files over the Internet using FTP.
Go to the menu by pressing F9, then type "P" to activate the FTP.
virtual filesystem. Enter a URL in the form "username:[email protected]"
_______________________________________
THE BASIC UNIX-LIKE WORK ENVIRONMENT
..........
THE LOGIN SHELL
Select the login shell with <mark><b>chsh(1)</mark></b>
PACKAGES
bash
tcsh
dash
zsh
pdksh
csh
sash
ksh
rc
posh
..........
SPECIAL KEY STROKES
On a normal Linux character console, only the left-hand Ctrl and Alt keys work as
expected.
.....
THE PAGER
<mark><b>less(1)</mark></b> is the enhanced pager.
Hit "h" for help. It can do much more than more(1)
.....
RECORDING THE SHELL ACTIVITIES
The output of the shell command may roll off your screen and may be lost forever.
It is good practice to log shell activities into a file for you to review them
later. Especially when performing system administration tasks.
The basic method of recording the shell activity is to run it under
<mark><b>script(1)</mark></b>.
EX...
<mark><b>$ script</mark></b>
<mark><b>Script started, file is typescript</mark></b>
Do whatever shell commands under script.
Press Ctrl-D to exit script.
<mark><b>$ vim typescript</mark></b> (to see the recorded file content)
.....
BASIC UNIX COMMANDS
</BODY></HTML>