We talked about file modes and permissions. Let’s review that on an example:
First character (looking from left to right) tells us if we are talking about a file or a directory or something else, the next three characters tell us user permissions, the next three tell us group permissions and the next three tell us world permissions.
Then we talked about the following:
chmod is used to change file permissions
chown is used to change file owner
umask defines the default permissions (keep in mind the octal to binary conversion we talked about and how it relates to permissions)
passwd is used to change users password
adduser is used to add users
userdel command is used to delete users
/etc/passwd keeps users and their IDs, while /etc/sudoers keeps the list of users who can execute the sudo command
14417 mislav 20 0 4222052 321880 168376 S 0.3 4.0 0:31.67 anki
First we have some information about current time, how long my machine has been running and how many users are logged in (Shotts, 2019)
load average – how many processes is your computer executing in the last minute, last 5 minutes, last 15 minutes
Tasks – how many tasks are there on the computer – 1 is running (meaning being actively executed), 239 are sleeping (meaning waiting for something to happen (such as data from a device) to resume their execution), 0 stopped (meaning no processes whose execution was paused manually) and 1 zombie process (zombie process is a process whose parent process doesn’t exist anymore)
%Cpu(s) tells us what percentage of the CPU is being used on what kinds of processes: us is for user processes, sy is for system (kernel) processes, ni is for nice (low-priority) processes, id is for the percentage of the CPU that is idle, wa is for percentage of the CPU waiting for some input/output tasks, hi is the time spent processing hardware interrupts, si is the time processing software interrupts and st is relevant to virtual environments – if you don’t know what virtual environments are, that needn’t concern you (“Linux ‘top’ command: What are us, sy, ni, id, wa, hi, si and st (for CPU usage)?,” n.d.)
MiB Mem and MiB swap tell you how much RAM and how much swap space is being used (measured in mebibytes (“Mebibyte,” n.d.))
Let’s now look at the columns available for each process: (“A Guide to the Linux ‘Top’ Command,” n.d.)
PID – proces ID
USER – user who owns the process
PR – process priority
NI – niceness (nice value) of a process
VIRT – total amount of memory consumed by the process (permanent storage device + RAM – the basic idea is that if the operating system runs out of RAM, it can use some memory available on the permanent storage device in addition to the RAM; this concept is called virtual memory – look it up on Google if you are interested)
RES – memory consumed by the process in RAM
SHR – amount of memory shared with other processes (processes can share memory)
S – process state (is the process running, is it sleeping, …)
%CPU – how much CPU is the process using (in percentages)
%MEM – how much memory is the process using (in percentages)
TIME+ – total time used by the process since it started
COMMAND – the name of the process
Hope you understand the output of top in detail now and hope you refreshed your memory!
We talked about command types, which there are 4 – executables, shell built-ins, shell functions and aliases, as well as the commands used to determine the type of a particular command. We also talked about finding files – both locate and find – and (hopefully) memorized the syntax find dir -name file -print.
We also covered some other stuff, but the above ones are the most important.