linuxacad Flashcards

1
Q

what are the two commands for uncompressing a file?

A

gzip -d (for decompress) or gunzip

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what tar command will show what is in the archive and compare it to the destination of an extract?

A

tar -dvf mytarfile (the d does a diff without extracting)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what command can be used to expand an archive without overwriting any destination files?

A

star -x -f=myarchive.tar

star is not a default installed file. yum install star will install it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what commands would make a change and put into effect a change to the sshd configuration?

A

vim /etc/sshd/sshd_config

systemctl restart sshd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what port does ssh use?

A

22 with encryption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what syntax is used by scp to specify a remote file and the user id to copy it with?

A

username@hostname:filename

root@rx1-tec-stc:~/Utilities/tmp/get_all_robot_probes.csv

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what key stroke allows searching the command history?

A

ctrl-r then start typing the command for automatic completion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what command logins in and runs the login shell for root?

A

su - root
su –login root
su -l
or just su -

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what command logs in but does not execute the login shell for root?

A

su (with no parameters)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what file is loaded and run when a user logs in with the login shell?

A

~/.bash_profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what file is a login script for all users?

A

/etc/profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how do you specify the destination file for an archive file?

A

tar -cvf myarchive.tar filetoadd1 filetoadd2 directorytoadd/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what command will show the contents of an archive file?

A

tar -tf myarchive.tar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what command will create an archive with gzip compression?

A

tar -cvzf myarchive.tar.gz (the z would compress and create a compressed file with gzip)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what command will create an archive with bzip compression?

A

tar -cvjf myarchive.tar.bz (the j would compress and create a compressed file with bzip)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what command shows how existing files have been changed since they were added to an archive file

A

tar -dvf myarchive.tar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what command would take away the write permission on a file for the owner of the file?

A

chmod u-w myfilename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

what command would use chown to change the group owner on a file or directory?

A

use a colon to designate the group name value

chown :mygroupname myfilename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

how do you set group permissions for a directory tree recursively?

A

chmod g+w -R mydir

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

what command would remove execute privileges on files but still allow access to directories recursively?

A

chmod ug-X -R mydir (the capital X does it)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what command would change the privileges on user, group and other at the same time?

A

chmod a+w myfilename

would grant write priveleges to user group and other

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what does the sticky bit do and what does it look like?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

how do you set the setuid bit on a file using octal notation?

A

chmod 4500 (4 = set user sticky bit 2 = set group sticky bit or 6500 set user and group sticky bit on)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what would prevent accidental deletion of a file even if they own the file?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

what is the default umask setting?

A

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–

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

where is the default setting for umask set for all users?

A

/etc/bashrc for all shells started

/etc/profile for all login sesisons started

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

what creates a man page index?

A

mandb

Once indexed, then you can use the command apropos to find all topics using a key word.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

what key in the info tool will show the navigation keys?

A

the question mark: ?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

where are the info files stored?

A

/usr/share/info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

what command would show all info pages related to the key word tee?

A

info –apropos tee

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

what command can show the directory location of a command executable?

A

locate mycommandname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

what command would refresh the search of the locate command?

A

updatedb

usually run by cron every day

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

what command will search man pages based on the entries description phrase?

A

whatis mycommandname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

what command would install the locate command?

What does the locate command do?

A

yum install mlocate

the locate command creates a cached DB containing the location of files found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

what command updates the cache for the locate command?

A

updatedb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

what command would reboot a machine in 5 minutes and tell all logged in users that?

A

shutdown -r +5 System reboot will happen in 5 minutes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

what command will stop a system reboot before it begins?

A

shutdown -c

38
Q

how do you schedule a reboot?

A

shutdown -r 00:00

reboot at midnight (24 hour values)

39
Q

what command would shutdown or power down a system?

A

systemctl halt

or

halt

40
Q

in what directory are the system state targets located?

A

/user/lib/systemd/system

41
Q

what command will show the available system states?

A

systemctl list-units –type=target

42
Q

what command would show the dependencies on the multi-user target?

A

systemctl list-dependencies multi-user.target

43
Q

what command shows the current run level?

A

systemctl get-default

44
Q

what target enters a read only file system state?

A

emergency.target

45
Q

what target enters a single user mode env for system recovery?

A

rescue.target

46
Q

how do you set the default target run level to multi user mode?

A

systemctl set-default multi-user.target

47
Q

how to you get to an special run mode for a system having trouble booting up?

A

interupt grub start (move the arrow keys for the menu)
select the default menu item
press ‘e’ to edit
find the linux16 line
at the end of that line add: system.unit=rescue.target
press Ctrl-x to move on in the boot mode into the rescue mode

48
Q

what command in the grub menu config would enable entering into the initfms system?

A

rd.break ( at the end of the linux16 line in the grub menu config line )

49
Q

what commands are needed in the initfs ram mode to modify configurations or correct a system problem before the system boots up into the kernel? Say to reset the root password if it is not known.

A

do an rd.break in the grub menu then ctrl-x

mount -oremount.rw /sysroot ( make the current system root directory read write )

chroot /sysroot ( change the system root directory from sysroot to /root )

passwd to change the current root password

touch /.autorelabel ( to force a relabel during the next boot up and relabel all files after making a change to the passwd file )

50
Q

what command shows the available signals for kill?

A

kill -l ( for list )

51
Q

what is the default signal issued by the kill command?

A

sigterm or kill -15 ( number for sigterm )

52
Q

what kill command is the same as a ctrl-C?

A

sigint or kill -2 ( user keyboard interupt )

53
Q

what command stops or pauses a process and then starts it again?

A

kill -19 ( sigstop )

kill -18 ( sigcont )

54
Q

what command would show the process id, command, and nice level?

A

ps axo pid,comm,nice

55
Q

what command would start a process and set the priority level of a process to zero and what is the priority range available?

A

nice -n 0

lowest priority is 20 up to highest priority -20

56
Q

what command would change the priority of all httpd running processes?

A

renice -n 10 $(pgrep httpd)

57
Q

what do the load average numbers shown with the top or uptime comands mean?

A

av for 1 minute, 5 minutes, 15 minutes
load average: 0.07, 0.58, 0.91
percentage of cpu processor used on average for each time period for the total number of processors (7% 58% and 91%). If there are 2 CPU’s then the usage is 7% divided by 2.

58
Q

what shows the number of cpu’s on a system?

A

cat /proc/cpuinfo | grep “model name” | wc -l

59
Q

what command will change the update interval for top?

A

top -d 1 for update every second

60
Q

What command controls the contents of the system messages log file?

A

journalctl

61
Q

where are the journald messges stored?

A

/run/log/journal

it is not persistent. Gets cleaned out during each reboot

62
Q

how do you make the journald messages persistent between reboots?

A

vi /etc/systemd/journal.conf
uncomment the line #Storage=auto and change it to Storage=persistent
restart the systemd service
changes the storage location from /run/log to /var/log

63
Q

what determines what log files are being updated and where they are located?

A

rsyslog

/etc/rsyslog.conf

64
Q

Whatcommand will display available systemd unit types?

A

systemctl -t help

65
Q

What command will create or update the manual page index caches; something you should run after installing new man pages?

A

mandb

66
Q

how many partitions can there be in the mbr partitition and what is the bit size basis?

A

only 4 partitions of 2 TB each because it is based on 32 bit math.

67
Q

what command in fdisk will show the available commands?

A

m for menu

68
Q

what is the replacement for mbr type partitioning and what features does it add to partitioning?

A
gpt
it is 64 bit based instead of 32 bit 
can accomodate more that 4 primary partitions
up to 128 partitions on a single devise
partitions can be larger that 2 GB
69
Q

what are the steps for adding an mbr partition and mounting it?

A

fdisk /dev/{device name}
n (for new)
p (for primary partition type or e for extended)
1 (for partition number)
+{number}M (for the next {number} megs of space)
l (for list available partition labels)
t (for change the partition system ID or type of partition)
w (for write the changes selected)
mkfs -.t xfs {device name}
blkid (to see the available block storage systems)
cd /mnt
mkdir {mountpoint}
mount /dev/{device name} /mnt/{mountpoint}

70
Q

what is the sequence for creating a logical volume?

A

create the paritions with gdisk using the LVM label type

create physical volumes with pvcreate (pvdisplay to see it)

create logical volume groups with vgcreate

create logical volume device with lvcreate

create partitions and mounts as usual

71
Q

What will create a new block device from existing block devices on an xfs file system device?

A

xfs_admin -L filesystem1 /dev/xvdfs1

72
Q

what will create a new block device on an ext4 block device?

A

tune2fs

73
Q

what are the fields in the fstab file for?

A

1 (fs_spec), describes the block special device or remote filesystem to be mounted.

2 (fs_file), describes the mount point for the filesystem. For swap partitions, this field should be specified as none.

3 (fs_vfstype), describes the type of the filesystem.

4 (fs_mntops), describes the mount options associated with the filesystem.

5 (fs_freq), is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped.

6 (fs_passno), is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time.

example:
/dev/mapper/vg_redweb-lv_root / ext4 defaults 1 1
UUID=68fed9db-aa05-4f03-885f-1daceb6ba6d3 /boot ext4 defaults 1 2
/dev/mapper/vg_redweb-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0

74
Q

how do you create a swap mount?

A

mkswap (NOT mkfs)

75
Q

what command will temporarily mount a swap disk?

A

swapon /dev/{devicename}

best to define it in fstab for permanent enabling between boots

76
Q

what command shows all the available block devices?

A

blkid

/dev/mapper/vg_redweb-lv_root: UUID=”205fb472-18ac-4e0a-85c6-592a4f064372” TYPE=”ext4”
/dev/sda1: UUID=”68fed9db-aa05-4f03-885f-1daceb6ba6d3” TYPE=”ext4”
/dev/sda2: UUID=”HP3yRX-KicC-U1mi-7l26-cgrf-l9Ck-ywncc0” TYPE=”LVM2_member”
/dev/mapper/vg_redweb-lv_swap: UUID=”a54bf4aa-4b79-4605-89c2-4c7542fc9ab7” TYPE=”swap”

77
Q

what command will show all the existing swap being used by the linux memory manager?

A

swapon -s

78
Q

After adding 50GB more of physical storage to your existing volume group, you need to extend your /dev/battlestar/galactica volume group to include an additional 20GB of storage. How might you accomplish this task?

A

lvextend -L +20G /dev/battlestar/galactica

79
Q

Which file on the operating system contains information about partitions the OS is reading?

A

cat /proc/swaps

80
Q

Which command is used to assign a swap signature to a device?

A

fdisk or gdisk

81
Q

What command(s) is used to inform the OS of partition table changes?

A

partprobe

82
Q

What are two ways to find information about swap devices enabled on the system?

A

swapon -s

cat /proc/swaps

83
Q

After making partition changes, the partition changes do not appear in the /proc/partitions. How can you force the kernel to reload the partition tables?

A

issue the partprobe command

84
Q

You are extending a logical volume. In order to do this, you have to add the /dev/xvdj device to the volume group “battlestar”. What command would you issue in order to accomplish this task?

A

vgextend battlestar /dev/xvdj

85
Q

Given the volume group “battlestar” and a physical volume in the volume group “/dev/xvdf1”, which command would accurately create a 19G logical volume out of /dev/xvdf1 with a volume name of “galactica”?

A

lvcreate –size 19G –name galactica /dev/xvdf1

check this

86
Q

What is the maximum disk size for a GPT based partition

A

GPT allocates 64 bits for logical block addresses, maximum size is 9.4 ZB or 8 ZiB

87
Q

Which command is used to assign a swap signature to a device?

A

mkswap

88
Q

You’ve just increased the size of the /dev/battlestar/galactica LVM volume. This volume is mounted in /mnt/mydir; what commands would you issue in order for the operating system and files system to recognize the increase in size on the device?

A

xfs_growfs /mnt/mydir

89
Q

Which tool(s) would you use to mange GPT based partitions?

A

gdisk

parted

90
Q

For an MBR partition, what is the max disk size a partition can be?

A

2TiB

91
Q

You are extending a logical volume. In order to do this, you have to add the /dev/xvdj device to the volume group “battlestar”. What command would you issue in order to accomplish this task?

A

vgextend battlestar /dev/xvdj