DEV Community

JohnOdhiambo
JohnOdhiambo

Posted on • Updated on

Linux/Ubuntu OS

Linux File System
It helps locate files swiftly, troubleshoot issues more effectively, and makes you a proficient developer or system administrator.

Image description
/Root
/bin: Binaries - This directory holds the essential user command binaries that all users can access.

/sbin: System Binaries - Contains the essential binaries used by the system administrator for system maintenance and troubleshooting.

/etc: System Configuration - Houses the system configuration files, acting as the control panel on Linux.

/dev: Device Files - Home to all device files, such as hard disks, USB, CD-ROM, etc.

/proc: Process Information - A virtual directory detailing system and process information.

/var: Variable Files - This is the variable data directory storing changing data like logs, mails, print spools, etc.

/tmp: Temporary Files - This directory stores temporary files created by the system and users.

/usr: User Binaries - Contains multi-user utilities, applications, and libraries.

/home: User Home Directories - Contains the home directories for users and other accounts.

/lib: System Libraries - Houses library files that are needed by the system and the users.

/opt: Optional Software - Stores optional or additional software from vendors.

/mnt: Mount Directory - Used for mounting other temporary file systems.

/media: Removable Media - Acts as a temporary mount directory for removable devices.

/srv: Service Data - This directory contains server-specific services related data.

/boot: Boot Files - Contains boot loader related files.

/root: Root Home - This is the home directory for the root user.

/run: Application Information - A tmpfs file system that contains application information.

/usr/local: User Local - Contains user's programs that are installed from the source.

/lib64: 64-bit Libraries - This is where the 64-bit library files are stored

General Commands
pwd - Generate file/folder path
touch file_name - Create a file
mkdir folder_name - Create a folder
Ctrl + O - Save
Ctrl + C - Cancel
Ctrl + X - Quit
Ctrl + O + M + X - Save and move back to terminal

sudo rm -rf - Remove a file
sudo rm -r - Remove a folder
mv folder_name/ destination_folder/folder_name - move a folder to the specified destination
sudo find / -name specified_name - find file anywhere with the specified_name
unzip foldername.zip -d /var/www/html - unzip to the specified path
sudo chown -R $USER /var/log/odoo/ - grant permission to the logged in user
sudo chown -R dev /var/log/odoo/ - grant permission to a specific user

lsof -i :8080 - List all processes running on the port
kill 64789 - Kill a given process

My SQL Terminal Commands
mysql -u root -p
show databases;
show table $tablName
show create table $tablName

Postgress Terminal Commands
sudo service postgresql restart
**
**sudo -u postgres psql
-d db_name - connect to db you want to use with postgres as user
\c db_name - connect to a different db
\dt - tables in a db
\d table_name *- schema of table
*
\q **- Quit psql
**sudo passwd postgres

*sudo passwd -d postgres
*

sudo -u postgres psql -c "\l" - List all databases
sudo -u odoo psql -d odoo - Use a specific DB

sudo -u postgres psql -c "CREATE USER steve WITH PASSWORD 'password';"

sudo -u postgres psql -c "SELECT * FROM pg_user WHERE usename='postuser';"

sudo -u postgres createuser -sS odoouser
sudo -u postgres createuser -s postuser
**
*sudo -u postgres psql -c "SELECT passwd FROM pg_shadow WHERE usename='postuser';"
*

**sudo -u odoo psql -c "ALTER USER odoo WITH PASSWORD 'password';"

sudo -u postgres psql -c "DROP USER odoouser;"

Top comments (1)

Collapse
 
ark7 profile image
M.Ark

Good insight on the OS.