Professional Documents
Culture Documents
One good way to memorize or remember Linux commands it’s consulting the history file that lists all
the past commands. /home/[username]/.bash_history or just type “history”.
Another option is “Apropos” command. This one help you to find the right command to use
searching through the description. It’s necessary to pay attention and try to use key work. Using the
“-a” flag between words helps to get more flexible results.
“man” command show you all the details about a command, including the syntax and flag to use
with.
Package Management
In Ubuntu’s package manager we use “apt” command. Usually with that you have the “install”,
“update” or “remove” options to include.
Basic commands
mkdir – my_new_folder or ‘my new folder’ you the name has spacesapro
sudo su –[with no value, change to root user directly] - change for root user. After that use “exit” or
the command below.
passwd [username] – Changing the user password. The -e flag force the user to change the
password.
-rwxr--r-- 1 student student 0 Mar 22 03:58 test_file – File or directory – Owner – Group – All other
users. Read (r - 4), write (w - 2), execute (x - 1) and disable (-).
chmod u+x / u-x [filename] – Changing the file permission. There are two ways of changing a file
permission. The firs one you can use a combination of who and which permission you are going to
add or remove. It’s possible to change just one or more. The second way is changing numerically.
When you change numerically you have to set the three permission at the same time. The owner (u),
the group (g) and other users (o).
dpgk -l | grep atom – Listing all the packages that have the search terms in the name
apt update - update list of available packages (Must always use before any installation)
parted -l – List all the disks you have connected to your computer
parted /dev/sdb – Initiate the parted tool. Inside this tool it’s possible to run mor commands
mkparty primary ext4 1Mib 5Gib - Creating a partition defining size, kind and file system.
mkfs -t ext4 /dev/sdb1 – Formatting the disk (Outside the parted tool)
fsck – IMPORTANT! Before use this command make sure the file system is unmounted. There’s a high
chance to damage a mounted partition.
Ps -ef – Used to get all the process, even for other users showing full details about them.
UID – The username who launched the process.
PID – Process ID
PPID – Parent ID
C – Number of children process that this process has.
STIME – The star time of this process
TTY – Terminal associated with the process
TIME – Total CPU time the process is taken up
CMD – Name of the command they are running.
ps -ef | grep chrome – Showing all the details about chrome process.
ctrl + c – Combination used to send sig.init (send process) signal through the keyboard.
kill – Without any flag this command sends a SIGTERM. Is used to terminate a process giving some
time to clean up the resources it was using. This time is import to minimize a file corruption.
kill -KILL – This flag sends a SIGKILL. You use that to kill a process without giving time to clean up. This
could be more harm to the files than good.
kill -SIGTSTP – It sends a SIGTSTP command and put the process in a suspended state.
top – Show you the top process that are using the most resources on your machine, total tasks, CPU
usage, memory usage and more.
Uptime – How long is your system running, current time, how many users are logged on and the load
average.
lsof – Used to list open files and what process are using it. This could help when you are trying to
eject a USB drive but the system shows up a message that your device or resource are busy.
/etc/group – File where it’s possible to view all the group members
sudo:x:27:cindy – group name – group password – group id – list of users in the group
/etc/password – File where it’s possible to view all the users on the machine
/etc/shadow – File where the user password are scrambled and stored.
/dev (usb – sda - usbhid – List all the physic and logical devices on the computer. Each device is a file.
The most common device types are Character devices and block devices. Character is like a keyboard
or mouse and block is USB drives, hard drives or CDROMs.
When you plug a device one Kernel module is created extending the kernel functionalities without
actually touching it. If you need to update a driver you have to install a kernel module the same way
you install a software.
/etc/fstab – File where disks should be mounted automatically when the operate system starts.
/var/log