Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
115 Cards in this Set
- Front
- Back
- 3rd side (hint)
How many consoles are there by default and which one is the GUI?
How do I get to the GUI one? What key combo? |
6
alt-F1 is the GUI |
|
|
Where would you change the number of consoles from the default of 6?
|
/etc/init/start-ttys.conf
|
|
|
What key combo would get you to console 3 of the 6 default consoles?
|
Ctrl Alt F3
|
|
|
What is the default shell in RHEL6?
|
BASH (Bourne-Again Shell)
|
|
|
How would you change the default shell for a user?
|
Edit their user in /etc/passwd
|
|
|
Where are the files for the different shells located?
|
/bin/ bash dash tcsh zsh
|
|
|
What are the four main Input/Output redirection operators?
|
>
>> 2> | |
|
|
What are the prompts for a:
Regular User ROOT User |
$
# |
|
|
What are the three basic data streams in Linux?
|
stdin - Data goes in
stdout - Data goes out stderr - Errors are sent in a different direction |
|
|
Give an example of taking a filename and stdin to a command
use cat for this |
cat filename
cat takes the contents of filename are then stdout to the screen |
|
|
Give an example of stdin from the left and the right
Left Right |
dmesg | less (Output from dmesg is being redirected to less)
database < datafile (datafile data is redirected to the database program) |
|
|
Give an example of stdout
Redirect ls listing to a file named filelist.txt in the root |
ls > /filelist.txt
|
|
|
How do you use stderr in an example redirection command?
Output errors from an ls command to errors.txt |
ls 2> /errors.txt
|
|
|
How do you combine the stdout and stderr?
Use pinging yahoo.com as an example |
ping yahoo.com > pinggood.txt 2> pingbad.txt
|
|
|
If you run the command "ping yahoo.com > pinggood.txt 2> pingbad.txt"
twice, what happens to the content of the destination files? |
Both files are created blank each time the command is run whether or not
they are empty |
|
|
If you run say ping yahoo.com > pinggood.txt 2> pingbad.txt
How do you avoid blanking the two files each time the command is run? |
ping yahoo.com >> pinggood.txt 2>> pingbad.txt
|
|
|
What directory are all users (root and regular) taken to by default?
|
To their home directory
/root /home/username |
|
|
What command can you use to go straight to your home directory
and where does it take you if you are: a normal user Root? |
cd ~
/home/humu /root |
|
|
How do you display the PATH?
|
echo $PATH
|
|
|
What is the difference between relative path and absolute path?
|
Absolute is based on the root and has a preceeding /
Relative is based on the current directory and has no preceeding / Relative is kelp/coral/fish_stuff Absolute is /home/humu/kelp/coral/fish_stuff |
|
|
How do you list the path for the current user?
|
echo $PATH
|
|
|
Is there any difference between the path for Root and others?
|
Not really anymore in RHEL6, but the path search orders are different, and there is a path
to /root/bin that root can use for special commands |
|
|
How do you adjust the path for an individual user?
|
edit /home/username/.bash_profile
|
|
|
How many available shells are there in Linux?
|
4
|
|
|
How do you change the shells a user gets when they log in?
|
Change the user's /etc/passwd entry to /bin/shell you want to use
|
|
|
How do you use ls to see SeLinux attributes?
|
ls -Z
|
|
|
What can touch do besides creating a new file?
|
It'll change the last accessed date/time of an existing file
|
|
|
How do you copy files recursively with the cp command?
|
cp -r
There is no -f in cp because there is no need to prompt for approval in a copy operation. (There is a -f, but it is for something else) |
|
|
What are hard and soft links?
|
Hard links contain a copy of the file, soft links just redirect you to the original file
|
|
|
What happens if you delete a hard link?
|
The other file remains still with the same inode
|
|
|
What happens to the soft link if you delete it's target?
|
The softlink remains, but doesn't go to anything - You see the ugly broken link
|
|
|
Creating Hard Links:
1. Create link from /home/humu/original.txt in / 2.from /home/humu/ create a hard link to /home/humu/cave/fish.txt |
1. from the root, ln /home/humu/original.txt /original.txt
-or- from the root ln/home/humu/original.txt (it'll place where you are) 2.ln cave/fish.txt |
|
|
Creating Soft Links:
Create link from /home/humu/original.txt in / from /home/humu/ create a hard link to /home/humu/cave/fish.txt |
from the root, ln -s /home/humu/original.txt
ln -s cave/fish.txt |
|
|
With hard and soft links, what happens if you delete the file:
SoftLink itself Original File softlink is linked to Hard Link itself Original File hardlink is linked to |
Original remains at the other location
Softlink remains with an error. If file is replaced at destination, softlink will point to it Original remains at the other location Hardlink remains with the original file data |
|
|
What happens if you edit a hard link
|
it gets changed in both locations regardless of which one you change
|
|
|
How do you delete recursively using rm?
|
rm -rf (r is recursively, f removes prompts)
|
|
|
Why is using -rf dangerous?
|
If you accidentally put a space after the slash you'd be screwed. Rm-rf / etc/test/
|
|
|
How can you create a whole strign of subdirectories using mkdir?
|
use mkdir -p /test/test1/test2
|
|
|
What does -i do in a command?
|
Prompts the user on whether they really want to do that
|
|
|
What does the -f with the rm command do?
|
Removes prompts (safety nets), it also supercedes -i, so don't use together
|
p.s. -f in the copy command is completely different and is not used (because there is no need to prompt for safety when copying). So the commands are:
cp -r rm -rf |
|
How do I make stuff go to a trash can instead of disappear?
|
edit /root/.bashrc
Change alias rm='rm -I' to alias rm='mv -t /root/.trash' save file mkdir /root/.trash |
|
|
How do you see the aliases set up for the current user?
|
alias
|
|
|
Where are the aliases configured?
|
in the users home directory, edit .bashrc
/home/humu/.bashrc /root/.bashrc |
|
|
What does the ? Do as a wildcard character?
|
One character only, so if you have the following files in a directory:
install installed interest inb , a search of ls in? will only return inb |
|
|
How do you use the [] in wildcard searches?
|
install
installed interest inb Using the above directory, ls in[s-t]* would give you install, installed, and interest NOTE: If you don't add the *, it gives you one character only, so it would only find ins if it existed |
|
|
When using the find command, what if you know the file
you are looking for is in the etc directory? |
Use find /etc -name host* (You can use a / after etc if you want - No Difference)
NOTE: this is instead of using find / -name |
|
|
If you want to use the instantaneous locate command,
how do you update the locate database and use it? |
to update, type /etc/cron.daily/mlocate.cron
to use, type locate hosts.allow |
|
|
What is the difference between more and less?
|
More just scrolls one way (oldest to newest) using space or enter
Less scrolls either way (starting with oldest) using page up and down |
|
|
When using more or less, how do you search?
And how do you search forward and backwards? |
The same as in vi, use / to search forward and ? To search backward
|
|
|
What is one cool advantage of less over more?
|
It can read compressed files compressed with gzip
|
|
|
What are the two commands to read the beginning or end of a file?
How do you use these commands to read more lines than the default? |
head and tail (reads 10 lines)
Use -n(no space)15 to read 15 lines so tail -n15 /var/log/secure will give you 15 lines from the end of the file |
|
|
How can you "follow" a file using tail?
|
use the -f switch tail -f
|
|
|
How are tarballs named
|
file.tar
file.tar.gz file.tgz |
|
|
How do you use sort?
|
sort /etc/passwd Gives you a sorted list alphabetically
|
|
|
How do you count the number of lines, words, and characters in a file?
|
wc /root/fish1
|
|
|
What are some cool vi commands related to cutting and pasting?
Undo text change Delete a line Copy a line Paste a line |
U - Undoes text change
dd - delete line yy - copy (yanks) a line into the buffer p - put the line |
|
|
What are some vi commands that will open common files?
Password file Groups File sudoers file |
vipw - passwd file
vigw - Groups file visudo - Edit the sudoers file |
|
|
What steps are required to add a user manually?
8 Steps |
vipw (Opens /etc/passwd)
passwd newuser vigr vigr -s (-s means edit groups shadow) Create users home directory in /home/newuser chown newuser:newuser /home/newuser chmod 700 /home/newuser cp -r /etc/skel/. /home/trigger |
|
|
How do you find man pages?
|
whatis nfs - for man pages with nfs in the title
apropos nfs - man pages with nfs in the description |
|
|
How do you update the man pages with the currently installed stuff?
|
/etc/cron.daily/makewhatis.cron
|
|
|
What's another cool utility to find out about commands?
|
info diff
(move to the * areas and hit enter for more information) OR - Just type info by itself |
|
|
What are the different commands to find information about commands?
|
info - uses * for hyperlink to additional info
whatis - Finds man pages with the search term in description apropos - Finds man pages with the search term in body man - Gives the regular Man page -h or --help - Gives basic switches that are in man |
|
|
What do each of the following help commands do?
info whatis apropos man command -h or --help |
info - uses * for hyperlink to additional info
whatis - Finds man pages with the search term in description apropos - Finds man pages with the search term in body man - Gives the regular Man page Gives the basic switches that are in man |
|
|
What are the two cron jobs that you should run once everything is in
place? |
makewhatis - Updates man pages with newly installed packages
mlocate - Updates the locate database with new files and directories that have been installed |
|
|
What command will give you the number of lines, words, and characters
in a file? |
wc (Short for Word Count)
|
|
|
Once again, where is the documentation store for packages located?
|
/usr/share/doc
|
|
|
How would you use whatis in real life?
|
To find the man pages available for a command that may hae more than one
context for it's man page. So you'd whatis ls and then see what pages are available, then man 1 ls to get the info listed on page 1 Or use man 1p ls to get the Posix administrator's guide version of ls |
|
|
How would I edit the following for a user?
aliases PATH |
/home/username/.bashrc
/home/username/.bash_profile |
|
|
How would I edit the following for a user?
PATH aliases |
/home/username/.bash_profile
/home/username/.bashrc |
|
|
What are the three key IP addresses that define a network?
Use 192.168.122.0/24 |
Network Address 192.168.122.0
Broadcast Address 192.168.122.255 Subnet Mask |
|
|
What is the network address?
Use 192.168.122.0/23 |
Always the first IP address in a range
192.168.122.0 |
|
|
What is the broadcast address?
Use 192.168.122.0/23 |
Always the last IP address in a range
192.168.123.255 |
|
|
What does ifconfig show you?
|
The current configuration of all active adapters
|
|
|
How would I see non-active adapters using ifconfig?
|
ifconfig -a (shows all)
|
|
|
How can you use ifconfig to assign an IP?
|
ifconfig eth0 192.168.22.150 netmask 255.255.254.0
|
|
|
How can you bring up and down network adapters with ifconfig?
|
ifconfig eth0 down
ifconfig eth0 up |
|
|
What is the full listing of ifconfig switches that are useful?
|
up, down, netmask, broadcast, metric
|
|
|
What is the proper netstat command to use so you don't get a large list?
|
netstat -nr
|
|
|
What is a good too to see network status?
|
service network status
|
|
|
If the network is down, what's the first troubleshooting step?
|
service network restart
|
|
|
When troubleshooting a network not working, when you run
ifconfig -a, what should you see? |
You should see UP next to your configured network devices
|
|
|
How do you list the runlevels of a service?
|
chkconfig --list network
|
|
|
What is the /etc/sysconfig/network-scripts/ifcfg-eth0 entry
of peerroutes=yes mean? |
You can use defined routes and not just the default route
|
|
|
Your network is down, what is the first set of stuff to check?
|
service network status (See if network service is up)
service network restart (Restart the service cause' it's easy) Look at /etc/sysconfig/network and make sure NETWORKING =yes chkconfig --list network (Verify its on in your runlevel) |
|
|
Your network is down, you've checked the network service, and verified
network service is set to startup using chkconfig, what next? |
See if network manager is used, look in /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth0 and look for NM_CONTROLLED="yes" If NM is used, verify it's started service NetworkManager start If networking was not configured during installation look at /etc/sysconfig/network-scripts/ifcfg-eth0 and verify ONBOOT="yes" |
|
|
Which config file has the following info about networking?
IP Address Subnet Mask Gateway HostName DNS Server DNS Search suffix order MAC Address |
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/hosts AND /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 AND /etc/resolv.conf <-- this is the key file /etc/resolv.conf /etc/sysconfig/network-scripts/ifcfg-eth0 |
|
|
what two directories do I need to look at if networking isn't working?
|
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0 |
|
|
Where do you access the network manager from?
|
Only from the GUI using nm-connection-editor
|
|
|
What are the two network configuration tools in RHEL 6?
|
system-config-network for the consolish one
nm-connection-editor for the GUI one |
|
|
What is a command to find out (or change) your hostname?
|
hostname (but it doesn't change /etc/hosts)
|
|
|
What should you do before you use the network configuration tools?
|
Backup /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
Where does the NM save it's configuration settings?
|
/etc/sysconfig/network-scripts/ifcfg-System_eth0
|
|
|
Where is the hosts file located?
|
/etc/hosts
|
|
|
A cloned system needs a different MAC address, what do you edit?
|
/etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
I want to edit all the basic network config stuff:
IP, subnet, Gateway, MAC |
/etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
How would you change the DNS search order from host file first to
DNS server first |
/etc/nsswitch.conf
|
|
|
Where would you edit the systems hostname?
|
/etc/sysconfig/network And /etc/hosts
|
|
|
Where would you edit the file to add DNS servers?
|
/etc/resolv.conf
|
|
|
Where would you edit your search suffixes?
|
/etc/resolv.conf
|
|
|
What is a more in depth tool than nslookup?
|
dig
|
|
|
What command can you use to bring a network adapter up and down?
|
ifup eth0
ifdown eth0 |
|
|
How does the mount command work? What is the format?
|
mount /dev/xxx /folder
|
|
|
How do you tell httpd to run in runlevels 3 and 5?
What if httpd is already set on in RL 4, will it be turned off? |
chkconfig --level 35 httpd on
RL 4 will stay on or off, this command is only additive |
|
|
How do you list the runlevels that httpd are on in?
|
chkconfig --list httpd
|
|
|
If you run the command chkconfig https on, which RLs get turned on?
|
2,3,4,5
(Same with off) |
|
|
Remove the httpd service
|
chkconfig --del httpd
Reboot |
|
|
Say the httpd service was removed. How do I add it and start it?
|
chkconfig --add httpd
chkconfig httpd on service httpd start service httpd status |
|
|
What are several ways to place hard links?
What is one important rule with regards to hard links? |
ln /home/humu/test.txt will place in the present directory
ln /home/humu/test.txt / will place in root ln /home/humu/test.txt /imatest.txt will place imatest.txt in root linked to test.txt in humu Hard Links cannot cross mounts |
|
|
With tar, what should always be the last option?
|
f because f tells the command that the next argument will be the name of the file
|
|
|
What would be a basic tar command to create a gzipped tar archive?
|
tar -cvzf nameofarchive.tar /etc/*
c- create v- verbose z- gzip it when done -f filename will be: |
|
|
What would be a basic tar command to extract a gzipped tar archive?
|
tar -xvzf nameofarchive.tar
|
|
|
How can I rebuild a totally jacked up network config from the ground up?
|
Delete:
/etc/sysconfig/network-scripts/ifcfg-eth0 /etc/resolv.conf /etc/sysconfig/network reconfigure networking using system-config-network Restart networking and edit files as needed |
|
|
Where would NETWORKING= yes/no be located?
|
/etc/sysconfig/network
|
|
|
How would I edit the profile for all users to add a $PATH?
|
edit the file /etc/profile
|
|
|
Where do I find the links to the old init configuration stuff: Ctl-alt-del, default RL's Root over SSH, Etc. ?
|
cat /etc/inittab
|
|