Erstellt von matt_b_uwe
vor mehr als 9 Jahre
|
||
Frage | Antworten |
Change Logged in User's Password | passwd |
Add a user | useradd <username> |
Change the password for JoeB | passwd JoeB |
Delete user JoeB leaving their home directory intact | userdel JoeB |
Delete user JoeB and remove their home directory | userdel -r JoeB |
Vi: keystroke to edit/insert | i |
vi: exit saving changes | :wq / :wq! |
vi: exit without saving changes | :q! |
vi: undo an edit | u |
vi: save file without closing | :w / :w! |
nano: delete whole line | ctrl + k |
nano: exit and save or don't save changes | ctrl + x and select option |
What information does /etc/passwd contain | bash shell home directory user id user group id username |
What file contains information about sudo privileges for users | /etc/sudoers |
how do you edit the sudoers file | visudo |
how is it best to assign sudo privileges to a user? | add them to a permission group specified in the sudoers file or create a group and add to sudoers |
what can be added to the end of sudoers group declaration to bypass need for password to be entered for sudo? | :NOPASSWD:ALL |
add existing user JoeB to the group "Wheel" | usermod -G wheel JoeB |
What config file determines the default useradd parameters | /etc/default/useradd |
create a directory "MyDirectory" | mkdir MyDirectory |
how to view the man page for a command | man <command> |
what are dot files? | They are hidden configuration files |
how can you list dot files in a directory? | ls -a |
how to view the last 10 lines of a file | tail <filename> |
how to view the first 10 lines of a file | head <filename> |
rename file "file" to "file1" | mv file file1 |
move up 1 level in the directory tree | cd .. |
who to get to current user's home directory | cd cd /home/<username> cd ~<username> |
how to recursively remove a directory? | rm -r <dir> rm -rf <dir> (if content) |
what files are present in /etc | configuration files e.g. bind, ssh, cron etc |
what files are present in /var | files that frequently change e.g. log files, library files |
How do you redirect output into a file? | > e.g. cat blah.txt > output.txt |
What does less do? | Allows navigation of a file |
less: move down the file one line | down arrow e |
less: move up the file one line | up arrow y |
less: move down file one window | f (forward) |
less: move up the file one window | b (back) |
less: go to specific line e.g. line 20 | type in the line number then shift-g |
less: search for occurence of word top to bottom | /<word> |
less: next occurence of word bottom to top | ?<word> |
less: when searching for pattern (/ or ?) go to next match | n (next) |
what does cron do? | allows user to schedule a task |
cron: where are user cron files stored? | /var/spool/cron |
cron: how to edit your (user) crontab? | crontab -e |
cron: how to edit the system cron? | Edit /etc/crontab (runs as root) |
What is YUM? | A RHEL RPM package manager |
Yum: search for a package | yum search <package name> |
Yum: install a package | yum install <package name> |
Yum: download and install system updates | yum update |
What is apt-get? | A Debian dkpg package manager |
What difference is there between the way YUM and apt-get operate? | apt-get caches repository info on the machine. Everytime you update or search via YUM it goes online to search |
apt-get: update the apt-get repo cache | apt-get update |
apt-get: search for a package | (sudo) apt-cache search <package name> |
apt-get: install a package | (sudo) apt-get install <package name> |
apt-get: download and update system packages | apt-get upgrade |
top: sort by memory utilisation | shift-m |
top: sort by cpu utilisation | shift-p |
top: what do the load averages represent? | 1min, 5min and 15 min load averages e.g. utilisation of cpu(s) over periods single core: 1.00 is 100% dual core: 2.00 is 100% etc |
top: what is the NI column | shows nice values for processess from -20 (highest priority) through 0 (default) to 20 (lowest priority) |
top: renice a process | r enter the PID enter nice value |
top: kill a process | k enter PID enter sigterm: 15 (quit) or 9 (force quit) |
check if locate installed | which locate if not installed use apt-get or yum to install |
update locate database | locatedb (as su) |
find: search current directory for filename blah.txt | find . -name 'blah.txt' |
find search whole system for filenames starting blah | find / -name 'blah*' |
apt-get: where would you place a third party repository source | /etc/apt/sources.list |
apt-get: how would you clear temporary source files data from the repository | apt-get clean |
apt-get: how would you clear temporary repository source files for applications no longer available in the source repository? | apt-get autoclean |
apt-get: how would you determine dependencies required for a package? | -s flag (simulate) e.g. apt-get install -s apache2 or apt-cache depends apache2 |
apt-get: which flag would you use to install a package without user prompting? | -y (yes) e.g. apt-get install -y apache2 |
apt-get: what flag would omit progress information for an install | -q (quiet) e.g. apt-get install -q apache2 |
apt-get: how would you download the source files for a package? | apt-get source <package> |
apt-get: what is the difference between apt-get upgrade & apt-get dist-upgrade | upgrade installs newest version of installed packages, without removing anything or retrieving new packages. upgrades are ignored if status of another package needs to be changed. upgrade-dist handles changed dependencies. |
apt-get: how would you update all packages including those such as the kernel that require changes to dependencies? | apt get dist-upgrade |
apt-get: how do you view information about the repository cache such as the number of packages available? | apt-cache stats |
apt-get: how do you get a list of all package names, e.g. for grepping and searching? | apt-cache pkgnames |
how would you count the number of lines in stdout? | wc -l (wordcount) |
apt-get: how do you display unmet dependencies in a repository cache? | apt-cache unmet |
How would you display the kernel version of current box? | cat /proc/version or uname -a |
what is dpkg? | dpkg is the software that handles .deb package installation, removal etc |
dpkg: how would you install a .deb package? | dpkg -i <packagename> |
dpkg: how would you install dependencies for a .deb package? | try installing the package with dpkg -i when the install fails with dependences run: apt-get update apt-get -f upgrade run dpkg -i again to install package |
apt-get: what does the -f flag do? | -f = fix it attempts fix broken dependencies i.e. where dpkg -i has failed |
dpkg: List installed packages | dpkg --get-selections |
dpkg: show all files installed with a package | dpkg -L <package name> |
dpkg: how would you run a package post-configuration file again | dpkg-reconfigure <package> |
dpkg: remove a package leaving configuration files | dpkg --remove <package> |
dpkg: remove a package including all configuration files | dpkg --purge <package> |
apt-get: what is aptitude? | it is an interface for apt-get that provides a GUI interface on the commandline |
what is dselect? | another interface for apt-get |
what is RPM | Redhat Package Manager, compiles, installs removes software packages for RHEL based distributions |
RPM: install a package | rpm -i <packagename> |
RPM: remove a package | rpm -e <packagename> |
RPM: what flags show verbose information during an install | -hv (hashes - shows progess bar verbose - displays more info) |
RPM: display information about an installed package | rpm -q <package name> |
RPM: display detailed information about an installed package | rpm -qi <packagename> |
RPM: show all files installed with a package | rpm -q --list <packagename> |
RPM: how would you determine dependencies required for a package? | rpm -qR <packagename> (-q - query -R - requirements) |
RPM: What does the -U flag do | Upgrade e.g. rpm -Uvh nano.rpm would install the rpm and remove the old version |
RPM: what does the -F flag do? | Freshen e.g. rpm -Fvh nano.rpm would only update the package if an existing version of it already exists on the system |
RPM: update the rpm database | rpm --rebuilddb |
RPM: where is the rpm config file | /usr/lib/rpm/rpmrc |
YUM: where is the yum config file | /etc/yum.conf |
YUM: where would you add a repository to yum? | /etc/yum.repos.d |
YUM: update a specific package | yum check-updates <packagename> |
YUM: what is the difference between update and upgrade? | upgrade is the same as update but has the --obsoletes flag set. Better for kernel updates |
YUM: remove a package | yum remove httpd.i686 |
YUM: display information about a package on the repo | yum list <packagename> |
YUM: display information about installed package | yum info <packagename> |
YUM: show dependencies for an installed package | yum deplist <packagename> |
YUM: what flag would force a package installation? | --force |
YUM: clean repository, install files etc | yum clean all |
what is yumdownloader? | a tool that downloads source RPM packages from yum repositories |
how would you download a source rpm file and all of its dependencies? | yumdownloader --resolve <packagename> |
what is rpm2cpio | converts an rpm file to a cpio archive |
How would you extract an RPM to an archive | rpm2cpio <package> > blah.cpio |
list the files in a cpio archive | cpio -t blah.cpio |
vi: What are the 3 modes of vi? | command mode ex mode (:) insert mode |
vi: Move left and right 1 character | left: h right: l |
vi: move up and down 1 character | up: k down: j |
vi: move to last line of the screen | shift+l |
vi: move to the first line of the screen | shift+h |
vi: move to the last line of the file | shift+g |
vi: move to a line number | type the line number then shift+g (or gg) |
vi: copy a line | yy (yank) |
vi: paste copied text | shift+p (line before cursor) p (line after cursor) |
vi: undo a change | u |
vi: copy a number of lines | type number of lines to copy then yy |
vi: search for a pattern | / |
vi: delete a number of lines | type number followed by dd |
vi: replace word cursor is on | cw |
vi: replace line cursor is on | cc |
vi: replace text rather than insert | shift+r |
vi: search and replace first occurence | :%s/pattern/replacement |
vi: search and replace every occurence | :%s/pattern/replacement/g |
vi: import content of a file into current file | :r /path/to/file |
vi: execute a shell command in vi | :!<command> |
what does 'split -l 2 filename' do? | splits filename into two files, using line 2 as the point to split |
What are Linux streams? | stdin (input from cmd line) stdout (output displayed in terminal) stderr (error messages) |
redirect output to a file | e.g. ls /etc > file |
append output to a file | e.g. ls /etc >> file |
redirect stderr to a file | <command> 2> file |
redirect stdout to a file and stderr to another file | <command> > file 2> errorfile |
redirect stderr and stdout to a single file | <command> >file 2>&1 |
what does the "noclobber" option mean | prevents redirect overwriting a file that already exists |
how do you turn on noclobber? | set -o noclobber |
grep: how to count matches | -c flag |
grep: case insensitive search | -i flag |
grep: use a file to input search pattern | -f <filename> |
grep: search a directory for a pattern in files | grep -r <pattern> /dir |
grep: search directory for pattern in filename | grep -rl <pattern> /dir |
grep: what is egrep? | allows extended regexp using | . * etc |
grep: search for a pat1 or pat2 | egrep 'pat1|pat2' <source> |
grep: how to return lines not matched | -v |
grep: what is fgrep | same as grep -F literal string match, doesn't interpret regex |
What does the cut command do? | outputs parts of lines from source, determined by deliminators |
how would you output the first field of a line, where the data is separated by colons | cut -f1 -d: <file> |
sed: what does sed do? | It is a stream editor, searching and modifying output |
sed: find and replace | sed 's/pattern/replacement/' <source> |
sed: find and output match to file | sed '/pattern/w output.txt' <source> |
sed: prevent standard output | sed <command> >/dev/null |
what does the tee command do? | redirects output to stdout and file(s) simultaneously |
how would you append output from tee to a file | -a flag |
What is the FHS | filesystem hierarchy standard |
what does /sys contain? | a virtual filesystem that represents the currently running kernel/system |
what does /proc contain? | a virtual filesystem containing information about currently running processes |
what does /dev contain | device files |
what do /dev/urandom and /dev/random do? | return random bytes based on system noise |
what does lsmod do? | lists installed modules from /proc/modules |
what does lspci do? | lists pci devices |
how would you search for a pci device by slot number | lspci -s <slot number> |
what does lsusb do? | lists installed usb devices on the system |
how would you view usb devices as a tree diagram | lsusb -t |
what is modprobe? | adds and removes modules from the kernel. Older systems (pre centos7) had the -l option to list modules - deprecated in favour of lsmod |
how would you remove a module? | modprobe -r <module> |
how would you add a module? | modprobe <module> |
what does insmod do? | it is an older legacy program that inserts modules into the kernel - requires full path to module file |
Grub2: Where is the grub configuration file? | /etc/default/grub |
Grub2: what command would you run after updating the grub conf? | update-grub |
Grub2: where are the menu options defined? | /etc/grub.d |
Grub2: how would you add a new menu option? | Copy an existing entry file and change the number to fit in desired location run update-grub to pull in changes |
What file specifies the filesystems mounted at boot? | /etc/fstab |
How do you list the UUID's for devices | blkid |
What is a cold-plug device? | something that had to be connected/disconnected with power off to prevent system or item damage e.g. cpu, memory, hard-drive etc. Has entry existing in the /dev/ dir |
What is a hot-plug device? | One that can be connected/disconnected any time and has built in support or loaded module to function. Entry is created in /dev directory when connected |
what information does /proc/mounts contain? | details of mounted filesystems |
what virtual filesystem could you cat to get cpu info? | /proc/cpuinfo |
What virtual filesystem might you look in to determine system hardware resources? | /proc |
what does /bin contain? | essential system binaries required for single user mode e.g. ls, cp etc |
what does /lib contain | libraries/shared libraries used by system functions |
what does /opt contain | optional application packages you've installed |
what does /sbin contain? | essential system binaries e.g. shutdown, init, fsck,iptables etc |
What does /usr contain? | "User userble programs and data" |
What methods can you use to find boot information? | look in /var/log/messages run dmesg |
What is the boot sequence? | System Start (BIOS) Stage 1 Bootloader (MBR - where is loader) Stage 2 - Bootloader (Grub) Kernel (Linux) Init (start user space) |
Grub: how would you edit the kernel line parameters? | highlight the kernel option and press e |
What do init and telinit do? | Effectively same command, allow you to change runlevel e.g. telinit 1 |
Cron: What does the cron.deny file do | It prevents users listed in the file from using the cron scheduling system |
Cron: what does cron.allow do? | If the file exists, it denies all users access to cron unless they are named in the file explicitly |
Cron: do cron.allow and cron.deny need to exist? | No, but if you wish to use them, only one of the other can exist - not both |
Möchten Sie mit GoConqr kostenlos Ihre eigenen Karteikarten erstellen? Mehr erfahren.