Linux Questions Flashcards
$
variable Use $ to retrieve the value of a variable, but not to create or change it.
/etc/password
contains all the accounts on the system -log in name, password info, user id, group id. etc….
ln
utility is used to create hard links
ln -s
utility is used to create soft (or symbolic) links
The -i option to ls
prints out in the first column the inode number
cat
Used for viewing files that are not very long; it does not provide any scroll-back.
tac
Used to look at a file backwards, starting with the last line.
less
Used to view larger files because it is a paging program; it pauses at each screen full of text, provides scroll-back capabilities, and lets you search and navigate within the file. Note: Use / to search for a pattern in the forward direction and ? for a pattern in the backward direction. (An older program named more is still used, but has fewer capabilities.)
tail
Used to print the last 10 lines of a file by default. You can change the number of lines by doing -n 15 or just -15 if you wanted to look at the last 15 lines instead of the default.
head
The opposite of tail; by default, it prints the first 10 lines of a file.
Displays Linux system information
uname -a
Displays kernel release information
uname -r
show which version of redhat is installed
cat /etc/redhat-release
show how long the system has been running + load
uptime
show system host name
hostname -I
show system reboot history
last reboot
show current date and time
date
show month;s calendar
cal
Quotes that contains strings and any variable or commands within them get evaluated or acted on
“double quotes”
Anything within these quotes gets treated literally, disables any special character functionality
‘single quotes’
This character disables any special character functionality that immediately follows it
\ (ie) $3.00 prints as $3.00 -won’t try to evaluate the 3.00 as a variable
_________ quotes around spaces or an escape character preceding a space will be treated literally
double quotes (or both double and single quotes)
\ (before”enter”)
Allows us to extend the command to multiple lines- this escapes out the enter key as the end of the command
________________What to do?
________________ How to do it?
________________ What to do it on?
Command
-Options
Arguments
searches a local database of files and folders looking for items that match the search criteria.
locate
searches the file system for files that match the search criteria. _____/path/to/folder -name * if we don’t provide a directory here, the command will start in the directory we are in. can give it part of the file name ‘*.xml’
find
locates binary source and/or man pages for a command
whereis
add a new user command?
adduser or useradd
a new user will typically own everything ______ and ______ the new users home directory.
including and beneath
Change ownership of the file named myfile to student use:
chown student myfile
changes the group ownership
chgrp
change the ownership and group ownership of many files at the same time, (only be used by the root user)
chown
ability to run commands as the root user without knowing the root password.
sudo
sudo users and which commands they can use are kept here.
/etc/sudoers