Linux Shell Cheatsheet Flashcards
- General: Unix file layout
the tree-like logical system layout that organizes and stores all files under directories. at the top of the system is the root, represented with /.
/bin/cp
/bin/is
/bin/pwd
/home/daniel/bin
/home/daniel/profile
etc
https://media.geeksforgeeks.org/wp-content/uploads/20221206120522/noname.png
tree
- General: * UTF
Unicode Transformation Format.
UTF-8: 9bit unicode conversion format.
UTF 65 = A
UTF 66 = B
etc
- Install: sudo
super user do
gives admin/root access rights, applies root access to commands
- Install: apt-get
command line tool for interacting with Advanced Package Tool (APT) Library. (package management system for Linux distributions)
allows you to search, install, manage, update and remove software.
- Install: install
copies files and sets file permissions.
install text.txt /target_directory
install -m 700 text.txt new_directory
(copies to new directory with rwx— permissions)
- Processes: jobs
process managed by shell
- Processes: ^Z/^C
^C kills current process,
^Z pauses the process.
- Processes: bg/fg
fg continues process from the background,
bg continues process in background
- Processes: &
sends the command to the background
- Processes: kill
kills a process. can also kill [ID] to target which process to kill
- Processes: killall
kills all processes in the background
killall sleep // kills all sleeps in the backgground
- Processes: wait
wait() system call suspends execution of the calling thread until one of its children terminates.
or, waits for the completion of any running processes. if multiple processes are running, only uses the last known command’s process id.
wait PID // waits until PID process finishes
3.1: Processes: %n
brings the job at position n to the foreground
3.1: Processes: ps
abbreviates ‘process status’.
ises to list currently running processes and their PIDs along with other info
lists PIDs and
3.1: Processes: nice
lowers a process’s priority
3.1. Processes: time
checks how long a process takes to complete
3.1: Processes: htop
nicer view compared to top. shows active processes, the PIDs, and other info
3.1: Processes: top
shows active processes, their PIDs and other info. but not as pretty as htop.
3.1: Processes: watch
reruns commands in a loop until stopped manually, or runs into a condition that stops the loop.
helps monitor something until it changes.
3.2: Processes: /proc
pseudo-filesystem, provides an interface to kernel data structures. mostly read-only.
displays kernel/system state, but read-only
3.2: Processes: suspend
uh, CTRL+Z?
can be continued with bg or fg
3.2: Processes: Notify-Send
sends notifications, alternative to windows pop-ups.
3.2: Processes: * batch
telling the system to execute commands from a list or queue.
can be made to run at late night or early morning to free the system for interactive.
can also set batch process priority to when CPU is not busy. nice.
use queuedefs fo;e tp describe queues managed by cron daemon. letters between a and y define queue name. tasks started by the at command placed in default queue for a. batch-started commands are placed in b queue. c is for tasks from the crontab file.
batch command will execute commands from standard input or a specified fille when the system load levels drop to a specific point.
3.2: Processes: * at
creates a list of commands to be excecuted at a specified time