General Flashcards
list the common shells
bash #The GNU Bourne Again Shell
sh #The Bourne shell upon which bash is based
tcsh #This shell is based on the earlier C shell
csh #The original C shell
ksh #The Korn shell; bourne shell+c shell+extended
zsh #The Z shell takes shell evolution further than the Korn shell
what is an internal command
a command that is built into the shell program
what is an external command
a command that is not built into the shell program
how do you reverse search for a command in your history
ctrl+r
how do you search for a command in your history
ctrl+s
how do you terminate a search through your command history
ctrl+g
how do you move your shell cursor to the beginning of the line
ctrl+a
how do you move your shell cursor to the end of the line
ctrl+e
how do you move the shell cursor back one character
Ctrl+b
how do you move the shell cursor forward one character
Ctrl+f
how do you delete the character under the shell cursor
Ctrl+d
how do you delete all text from the shell cursor to the end of the line
ctrl+k
how do you delete all of the text from the shell cursor to the beginning of the line
Ctrl+x and then Backspace
how do you transpose the character before the cursor with the character under the shell cursor
ctrl+t
how do you transpose the two words immediately before (or under) the shell cursor
Esc and then t
how do you convert text from the shell cursor to the end of the word to uppercase.
Pressing Esc and then u
how do you convert text from the cursor to the end of the word to lowercase
Esc and then l
how do you convert the letter under the cursor (or the first letter of the next word) to uppercase; leaving the rest of the word unaffected.
Esc and then c
how do you launch a full-fledged editor to edit a command at the shell
Ctrl+x followed by Ctrl+e
how do you set an enviornment variable
VARNAME=VALUE
how do you save an environment variable across sessions
export VARNAME
how do you set and save an environment variable across sessions
export VARNAME=VALUE
what is man section 1
Executable programs and shell commands
what is man section 2
System calls provided by the kernel
what is man section 3
Library calls provided by program libraries
what is man section 4
Device files (usually stored in /dev )
what is man section 5
File formats
what is man section 6
Games
what is man section 7
Miscellaneous (macro packages; conventions; and so on)
what is man section 8
System administration commands (programs run mostly or exclusively by root )
what is man section 9
Kernel routines
what is stdin’s file descriptor
0
what is stdout’s file descriptor
1
what is stderr’s file descriptor
2
how do you specify all numbers and letters in the tr command
[:alnum:]
how do you specify all uppercase letters in the tr command
[:upper:]
how do you specify all lowercase letters in the tr command
[:lower:]
how do you specify all numbers in the tr command
[:digit:]
how do you specify a range of characters in the tr command
You can specify a range of characters by separating them with dashes ( - ); as in A-M
how do you move forward one screen in less
spacebar
how do you move back one screen in less
Esc followed by v
how do you do a search in less
/STRING
how do you do a backward search in less
?STRING
how do you move to the next search result in less
n
how do you move to the previous search result in less
N
how do you go to a specific line in less
gNUMBER
how do you display the help system in less
h
what are the extended regular express characters
? + | ( )
what is the windows newline
/r/n
what is the mac newline
/n
what is the linux newline
/n
how could you use tr to convert from windows to linux format line endings
tr -d \r < dosfile.txt > unixfile.txt
how could you use sed to convert from linux to windows line endings
sed “”s/$/\r/”” unixfile.txt > dosfile.txt
describe the naming convention of this rpm package: string-a.b.c-x.y.rpm
string = Package Name a.b.c = Version Number x = Build Number y = Architecture
How would you use rpm to install or upgrade package samba-4.1.9-4.fc20.x86_64.rpm from an RPM file that you have already downloaded to your local system
rpm -Uvh samba-4.1.9-4.fc20.x86_64.rpm
how would you query information on the installed package samba using rpm
rpm -qi samba
how would you convert samba-4.1.9-4.fc20.src.rpm to samba-4.1.9-4.fc20.src.cpio
rpm2cpio samba-4.1.9-4.fc20.src.rpm > samba-4.1.9-4.fc20.src.cpio
how would you extract samba-4.1.9-4.fc20.src.cpio
cpio -i –make-directories < samba-4.1.9-4.fc20.src.cpio
how would you extract samba-4.1.9-4.fc20.src.rpm on a system without rpm
rpm2cpio samba-4.1.9-4.fc20.src.rpm | cpio -i –make-directories
how do you install samba_4.1.6+dfsg- 1ubuntu2.1404.3_amd64.deb
dpkg -i samba_4.1.6+dfsg-1ubuntu2.1404.3_amd64.deb
how do you uninstall samba using dpkg
dpkg -r samba
what information is displayed by ps
username; process id; parent process id; tty; cpu time; cpu priority; memory usage; command
how do you send a program to the background
ctrl+z
what is process signal 1 and what does it do
SIGHUP ; which terminates interactive programs and causes many daemons to reread their configuration files
what is process signal 9 and what does it do
SIGKILL ; which causes the process to exit without performing routine shutdown tasks)
what is process signal 15 and what does it do
SIGTERM ; which causes the process to exit but allows it to close open files and so on
what is process signal SIGHUP and what does it do
1 ; which terminates interactive programs and causes many daemons to reread their configuration files
what is process signal SIGHKILL and what does it do
9 ; which causes the process to exit without performing routine shutdown tasks)
what is process signal SIGHTERM and what does it do
15 ; which causes the process to exit but allows it to close open files and so on
what is an interrupt request
a signal sent to the CPU instructing it to suspend its current activity and to handle some external event such as keyboard input
what is IRQ 0
system timer
what is IRQ 1
keyboard
what is IRQ 2
handles IRQ 8-15
what is IRQ 3
COM2
what is IRQ 4
COM1
what is IRQ 5
LPT2 / Sound card
what is IRQ 6
Floppy controller
what is IRQ 7
parallel port
what is IRQ 8
real time clock
what is IRQ 12
ps2 mouse
what is IRQ 13
floating point proc
what is IRQ 14
primary IDE
what is IRQ 15
secondary IDE
what are i/o addresses
unique locations in memory that are reserved for communications between the CPU and specific physical hardware devices
what is direct memory addressing
an alternative method of communication to I/O ports. Rather than have the CPU mediate the transfer of data between a device and memory; DMA permits the device to transfer data directly; without the CPU’s attention
how does the BIOS boot process begin
the computer reading a boot sector (typically the first sector) from a disk and then executing that code
how does the EFI boot process begin
the computer reading a boot loader file from a filesystem on a special partition; known as the EFI System Partition (ESP) . This file either can take a special default name or can be registered in the computer’s NVRAM
what is the HAL Daemon
The Hardware Abstraction Layer (HAL) Daemon ; or hald ; is a user-space program that runs at all times (that is; as a daemon) and provides other user-space programs with information about available hardware
what is the D-Bus
The Desktop Bus (D-Bus) provides a further abstraction of hardware information access. Like hald ; D-Bus runs as a daemon. D-Bus enables processes to communicate with each other as well as to register to be notified of events; both by other processes and by hardware (such as the availability of a new USB device).
what is mbr partition code 0x0c
fat
what is mbr partition code 0x05
old extended code
what is mbr partition code 0x07
ntfs
what is mbr partition code 0x0f
newer extended code
what is mbr partition code 0x82
linux swap
what is mbr partition code 0x83
linux filesystem
what is mbr partition code 0x8e
LVM
what directories should never be on a seperate partition from /
/bin /dev /etc /lib /sbin
describe ext2fs
traditional Linux-native filesystem; no journaling
describe ext3fs
ext2 with journaling
describe ext4fs
ext3 with performance and size extensions
describe ReiserFS
designed from scratch as a journaling filesystem for Linux. It’s particularly good at handling large numbers of small files (
describe JFS
IBM developed the Journaled File System (JFS) for its AIX OS on mainframe systems and later reimplemented it on its attempt at a workstation OS; called OS/2. After the demise of OS/2; the OS/2 version of JFS was subsequently donated to Linux
describe XFS
Silicon Graphics (SGI) created its Extents File System (XFS) for its IRIX OS and; like IBM; later donated the code to Linux. Like JFS; XFS is a very technically sophisticated filesystem. XFS has gained a reputation for robustness; speed; and flexibility on IRIX; but some of the XFS features that make it so flexible on IRIX aren’t supported well under Linux.
describe Btrfs
is an advanced filesystem with features inspired by those of Sun’s Zettabyte File System (ZFS).
describe FAT
old and primitive—but ubiquitous. It’s the only hard disk filesystem supported by DOS and early versions of Windows (such as the Windows 9 x series and the short-lived Windows Me). For this reason; every major OS understands FAT;
describe NTFS
the preferred filesystem for Windows NT and beyond. Unfortunately; Linux’s NTFS support is rather rudimentary. As of the 2.6. x kernel series; Linux can reliably read NTFS and can overwrite existing files; but the Linux kernel can’t write new files to an NTFS partition. There are separate drivers outside of the kernel that you can use in Linux to create new files on an NTFS filesystem
describe HFS[+]
Apple has long used the Hierarchical File System (HFS) with its Mac OS; and Linux provides full read/write HFS support. This support isn’t as reliable as Linux’s read/write FAT support; though; so you may want to use FAT when exchanging files with Mac users.
describe ISO-9660
CD-ROMs; Linux Rock Ridge extensions; Joliet Windows extensions
describe UDF
Universal Disc Format (UDF) is the next-generation filesystem for optical discs. It’s commonly used on DVD-ROMs and recordable optical discs. Linux supports it; but read/write UDF support is still in its infancy.
describe the /etc/fstab file format
#device mount point filesystem options dump(1 means the dump program should do a dump) fsck(fsck check order, 0 means don't check) e.g. UUID=3631a288-673e-40f5-9e96-6539fec468e9 \ /usr reiserfs defaults 0 0
what does “credentials=/etc/creds” in the options column of the /etc/fstab signify
the login credentials(username and password) are stored in /etc/creds
what characters should not be used in filenames
- ? / \ “”
what are the wildcard expansion characters
? * [a-z]
what are the three timestamps on each file
Last file-modification time
Last inode change time
Last access time
how would you compress ∼/my-work and gzip it into /media/pen/my-work.tgz
tar cvfz /media/pen/my-work.tgz ∼/my-work
what are the file type codes displayed by ls -l
- normal file
d directory
l symlink
p named pipe (A pipe enables two running Linux programs to communicate with each other. One opens the pipe for reading; and the other opens it for writing; enabling data to be transferred between the programs)
s socket (similar to a named pipe; but it permits network and bidirectional links)
b block device (a file that corresponds to a hardware device to and from which data is transferred in blocks of more than 1 byte. Disk devices (hard disks; USB flash drives; CD-ROMs; and so on))
c character device (a hardware device to and from which data is transferred in units of 1 byte. Examples include parallel port; RS-232 serial port; and audio devices)
what does the directory execution bit do
When a directory’s execute bit is set; that means that the directory’s contents may be searched
what does the write bit on a directory do
if a user can write to a directory; that user can create; delete; or rename files in the directory as well
use the sticky bit to alter this behavior
what are the permissions of a symlink
always 777
trying to change it’s permissions will affect the file it points to
how is set user id represented
4000
SUID
s in the owner’s execute bit
If the SUID bit is set on a file without execution permission set; the permission string appears with a capital S ; as in rwSr-xr-x . However; in this case; SUID will not function and the setting is called benign .
how is set group id represented
2000
SGID
s in the group’s execute bit
f the SGID bit is set on a file without execution permission set; the permission string appears with a capital S ; as in rwsr-Sr-x . Also in this case the setting is benign.
SGID is also useful on directories. When the SGID bit is set on a directory; new files or subdirectories created in the original directory will inherit the group ownership of the directory rather than be based on the user’s current default group
how is sticky bit represented
1000
t in the world’s execute bit
When this bit is present on a directory; the directory’s files can be deleted only by their owners; the directory’s owner; or root
what is a typical default umask
002 or 022
how would you set the permissions of newly created folders to have rwxrxrx permissions symbolically
umask u=rwx,g=rx,o=rx
how would you add user quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 usrquota 1 1
how would you add group quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 grpquota 1 1
how would you add user and group quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 usrquota,grpquota 1 1
what is the old filesystem structure for linux called
FSSTND
Filesystem Standard
Standardized the programs that reside in
/bin and /usr/bin.
Specified that executable files shouldn’t reside in
/etc
Removed changeable files from the
/usr
enabling it to be mounted read-only (a useful security measure).
what is the current filesystem structure
Filesystem Hierarchy Standard (FHS)
Shareable; Unshareable; Static; Variable
what are some static shareable directories in FHS
/usr
/opt
what are some static unshareable folders in FHS
/etc
/boot
what are some variable shareable folders in FHS
/home
/var/mail
what are some variable unshareable folders in FHS
/var/run
/var/lock
what directories are recommended to have their own partition
/boot /home /opt /tmp /usr /usr/local /var
how does grub legacy start a boot entry
title
how does grub 2 start a boot entry
menuentry
what is the system logger
syslogd
writes files to
/var/log/messages
/var/log/syslog
what are the 3 popular initialization process methods used in linux
Unix System V (also called SysV)
Upstart (ubuntu; each service has a configuration file)
systemd (redhat) (this is the winner! everyone important is switching to it)
describe runlevel 0
shutdown
A transitional runlevel; meaning that it’s used to shift the computer from one state to another. Specifically; it shuts down the system. On modern hardware; the computer should completely power down. If not; you’re expected to either reboot the computer manually or power it off.
describe runlevel 1
also s or S
Single-user mode. What services; if any; are started at this runlevel vary by distribution. It’s typically used for low-level system maintenance that may be impaired by normal system operation; such as resizing partitions.
describe runlevel 2
On Debian and its derivatives; a full multi-user mode with X running and a graphical login. Most other distributions leave this runlevel undefined.
describe runlevel 3
On Fedora; Mandriva; Red Hat; and most other distributions; a full multi-user mode with a console (nongraphical) login screen.
describe runlevel 4
Usually undefined by default and therefore available for customization.
describe runlevel 5
On Fedora; Mandriva; Red Hat; and most other distributions; the same behavior as runlevel 3; with the addition of having X run with an XDM (graphical) login.
describe runlevel 6
Used to reboot the system. This runlevel is also a transitional runlevel. Your system is completely shut down; and then the computer reboots automatically.
what is a systemd unit
defines a service or action on the system
eg. mount; service; snapshot
what are the systemd units
automount device mount path service snapshot socket target