<BLANKSPACE>COMMAND
<blankspace>command |
by having a leading space before a command, it will not show up in history. |
If you were to have a leading space then this command echo "Not in history" that will not show up in history.
journalctl
journalctl |
displays all log entries. |
dnf remove "package name"
dnf remove "package name" |
by doing dnf remove "package name" it removes it |
systemctl restart
systemctl restart |
restarts a specific service |
example would be systemctl restart httpd where httpd is the name of the service to be restarted.
dnf search "program name here"
dnf search "program name here" |
this finds a program and gives the code to install with dnf install. |
systemctl reload-or-restart
systemctl reload-or-restart |
best of both worlds, if you are unsure whether a program supports reload use this command to first try reload and if it fails it will restart. |
systemctl reload-or-restart httpd will first try to reload the program and if that is not doable it will restart.
chown <userid> /home/userid/
chown <userid> /home/userid/ |
changes the owner of the directory. |
dig <hostname or ip>
dig <hostname or ip> |
queries DNS servers and returns information about a domain. |
TAIL -N5 FILENAME
tail -n5 <filenamehere> |
gives the last 5 lines of the file. |
du -a /dir/ | sort -n -r | head -n 20
du -a /dir/ | sort -n -r | head -n 20 |
shows file sizes in reverse order by biggest first in a specific directory. |
crontab -a <filename>
crontab -a <filename> |
Installs the specified filename as your chrontab file. |
This chrontab file can be used to automate and schedule tasks.
alias name "command here"
alias name "command here" |
creates an alias for a command that can be called. |
Extremely useful for long commands.
ECHO "TEXTHERE" > .hiddenfile
echo "texthere" > .hiddenfile |
will write the string texthere to a new .hiddenfile |
Easy way to write one line into a file or directory without much fuss.
PS AUX
ps aux |
shows all processes being run by everybody (most are being run by root) |
MAN PS
man ps |
gives you the man page for ps |
PS
ps |
shows all running processes |
ssh username@ipaddresshere
ssh username@ipaddresshere |
Allows you to remotely access another machine or server. |
env
env |
lists all the current environment variables |
cmp <file 1> <file 2>
cmp <file 1> <file 2> |
performs a byte by byte comparison of two files. |
locate <filename here>
locate <filename here> |
Finds a all indexed instances of a file. |
SUDO !!
sudo !! |
redoes the last command as root |
Convenient if you always forget to make yourself root!
|
|
bg
bg |
runs a process in the background. |
You can also add the <&> symbol to the end of a file name or command to accomplish the same thing.
/usr/sbin/traceroute <hostname or ip here>
/usr/sbin/traceroute <hostname or ip here> |
tells you the route that packets take. |
Very similar to ping, but goes into a little more detail.
HISTORY
history |
prints the last 500 - 1000 commands |
ip route del <ip here>
ip route del <ip here> |
Deletes a created ip route, opposite of ip route add. |
ifconfig
ifconfig |
The “ifcowill display all the active interfaces details. The ifconfig command also used to check the assigned IP address of an server. |
reminds me of ipconfig on windows, a little different.
systemctl reload
systemctl reload |
similar to restart, however program will reload and reread config files without restarting. |
systemctl reload httpd will reload and reread httpd's config files without a restart.
Downside is not all programs support reload!
tree
tree |
displays files and directories in their proper parent -> child relationship. |
Gives an easy to read format for directories and the files or directories underneath. Think of the first assignment we did in class.
touch <filename>
touch <filename> |
creates or edits a file by specified name. |
If file doesn't exist it will create it!
systemctl enable
systemctl enable |
allows or enables a process to start on startup |
pip install <desired program>
pip install <desired program> |
uses pip to install a program. |
In our case we use pip install jupyterhub.
LS
LS |
lists files in the current directory |
CD ..
cd .. |
go to the above or parent directory of the present directory |
If directories were like this Tree --> Branch --> Leaf and you were working in the "Branch directory" by executing cd .. it would take you to the Tree directory.
CD
cd |
change directory used as cd <directoryname> |
DISOWN -A && EXIT
disown -a && exit |
closes the terminal, but keeps all processes running. |
Normally, when you close a terminal, all processes terminate due to a "hang-up" signal. Disown -a states to ignore the hang up signal and keep everything running while closing the terminal.
cp -r <directoryname> <newdirectroyname>
cp -r <directoryname> <newdirectroyname> |
copies the directory recursively with all files to the new name |
pwd
pwd |
gives the present working directory |
will spit out the present working directory which will look like this Dylan/Desktop/Class
LS -A
ls -a |
shows everything in the working directory! Even hidden files! |
hidden files look like this .hiddenfile
dnf upgrade
dnf upgrade |
dnf package manager to update software on fedora |
su
su |
the same thing as sudo, makes you root. |
efibootmgr -v
efibootmgr -v |
shows the summary of the boot configuration |
efibootmgr can be used to change boot order, usually has to be run as root.
|
|
hwclock
hwclock |
used to manage system clock. |
hwclock --set --date 10/02/2019 |
sets clock date to 10/02/2019 |
SUDO SHUTDOWN NOW
sudo shutdown now |
properly shuts down the machine |
tac <filenamehere>
tac <filenamehere> |
prints out the last line of a file first. |
Useful if you are looking for something recently added to a file (such as a new user.)
MKDIR
mkdir |
stands for make directory, creates a folder |
RM
rm |
stands for remove (as in delete) a file or folder depending on user choice |
arch
arch |
displays machine architecture and system information (hardware) |
RM -R <DIRECTORYNAMEHERE>
rm -r <directoryname> |
allows one to properly delete a directory even if it has child directories. |
grep pattern files
grep pattern files |
searches for patterns in files. |
grep -r pattern dir |
searches for patterns in files recursively thru directories. |
gzip <filename>
gzip <filename> |
compresses a file. |
For example if file was named file and command gzip file was run it would make file.gz
HISTORY
history |
shows the history of commands executed. |
So if you typed cd Desktop , then ls , then cd Class , if you typed history it would show you executing cd Class, ls, cd Desktop.
systemctl get-default
systemctl get-default |
To see the target the system boots into by default. |
FC
fc |
Opens the last command entered in editor (such as nano) |
Useful for long commands that are messed up, opens last command in a text editor to fix.
ip route add <ip here> via <gateway router here>
ip route add <ip here> via <gateway router here> |
These commands add a route to a specified network through the gateway router of choice. |
find . -name *.pdf
find . -name *.pdf |
finds all files in the current directory with a name that ends in the .pdf extension. |
You can do find <name of directory> with a -name
ping <hostname or ip here>
ping <hostname or ip here> |
pings a website and returns if the packets were sent |
grep -r "Find this line"
grep -r "Find this line" |
searches the contents of files themselves for find this line. |
systemctl edit httpd --full
systemctl edit httpd --full |
allows you to edit the httpd system files, can change description etc. |
systemctl status
systemctl status |
give an overview of all the processes running within a program, some of the log files, etc. |
Provides a nice overview with a bit of everything.
dnf install "code here"
dnf install "code here" |
After doing a dnf search it will give you a code such as mc, you then do dnf install mc to get that program |
systemctl is-active
systemctl is-active |
see if a process is running or not. |
|