linuxacad Flashcards
what are the two commands for uncompressing a file?
gzip -d (for decompress) or gunzip
what tar command will show what is in the archive and compare it to the destination of an extract?
tar -dvf mytarfile (the d does a diff without extracting)
what command can be used to expand an archive without overwriting any destination files?
star -x -f=myarchive.tar
star is not a default installed file. yum install star will install it.
what commands would make a change and put into effect a change to the sshd configuration?
vim /etc/sshd/sshd_config
systemctl restart sshd
what port does ssh use?
22 with encryption
what syntax is used by scp to specify a remote file and the user id to copy it with?
username@hostname:filename
root@rx1-tec-stc:~/Utilities/tmp/get_all_robot_probes.csv
what key stroke allows searching the command history?
ctrl-r then start typing the command for automatic completion.
what command logins in and runs the login shell for root?
su - root
su –login root
su -l
or just su -
what command logs in but does not execute the login shell for root?
su (with no parameters)
what file is loaded and run when a user logs in with the login shell?
~/.bash_profile
what file is a login script for all users?
/etc/profile
how do you specify the destination file for an archive file?
tar -cvf myarchive.tar filetoadd1 filetoadd2 directorytoadd/
what command will show the contents of an archive file?
tar -tf myarchive.tar
what command will create an archive with gzip compression?
tar -cvzf myarchive.tar.gz (the z would compress and create a compressed file with gzip)
what command will create an archive with bzip compression?
tar -cvjf myarchive.tar.bz (the j would compress and create a compressed file with bzip)
what command shows how existing files have been changed since they were added to an archive file
tar -dvf myarchive.tar
what command would take away the write permission on a file for the owner of the file?
chmod u-w myfilename
what command would use chown to change the group owner on a file or directory?
use a colon to designate the group name value
chown :mygroupname myfilename
how do you set group permissions for a directory tree recursively?
chmod g+w -R mydir
what command would remove execute privileges on files but still allow access to directories recursively?
chmod ug-X -R mydir (the capital X does it)
what command would change the privileges on user, group and other at the same time?
chmod a+w myfilename
would grant write priveleges to user group and other
what does the sticky bit do and what does it look like?
allows a program to be run with the same privileges as the owner (or the group owner) of the file.
ls -la myfile
-r-sr-sr-x myfile
how do you set the setuid bit on a file using octal notation?
chmod 4500 (4 = set user sticky bit 2 = set group sticky bit or 6500 set user and group sticky bit on)
what would prevent accidental deletion of a file even if they own the file?
setting the sticky bit on the “other” on a file:
chmod -t myfilename
r-s r-s r-T root root myfilename
the T means others can read it but the user cannot delete it.
what is the default umask setting?
0022
default file perms are always 666. if the umask is 2 then subtract 2 from 6 you get 4 which means set r read but not write or x. as in r–
where is the default setting for umask set for all users?
/etc/bashrc for all shells started
/etc/profile for all login sesisons started
what creates a man page index?
mandb
Once indexed, then you can use the command apropos to find all topics using a key word.
what key in the info tool will show the navigation keys?
the question mark: ?
where are the info files stored?
/usr/share/info
what command would show all info pages related to the key word tee?
info –apropos tee
what command can show the directory location of a command executable?
locate mycommandname
what command would refresh the search of the locate command?
updatedb
usually run by cron every day
what command will search man pages based on the entries description phrase?
whatis mycommandname
what command would install the locate command?
What does the locate command do?
yum install mlocate
the locate command creates a cached DB containing the location of files found
what command updates the cache for the locate command?
updatedb
what command would reboot a machine in 5 minutes and tell all logged in users that?
shutdown -r +5 System reboot will happen in 5 minutes.