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.