Files
linux/README.md
Márcio Fernandes 1fcbabd754 modified: README.md
modified:   docs/file-systems.md
2025-11-01 22:38:37 +00:00

6.9 KiB
Raw Permalink Blame History

Linux

Distros

Graphical Environment

Display Managers

🎛️ A display manager is the graphical login screen you see when you boot your system.

Main job: It handles user sessions — letting you log in, choose a user, select a desktop environment, and start the graphical session.

Examples:

cli - utils

check which display manager is currently running on your system.

Debian:

systemctl status display-manager

Graphical Applications

Gnome Files/Nautilus

https://www.maketecheasier.com/useful-nautlius-tweaks-linux/

Commands and Utilities

Navigation and File Management

📁 List information about the FILEs (the current directory by default).

#order by date 
ls -t

#order by date reverse
ls -r

# list all
ls -lah

Archiving and Compression

tar

📦 tar is a command-line utility in Unix/Linux used to archive multiple files into a single file, often for backup, compression, or distribution. The name stands for “tape archive”, originally designed for writing data to magnetic tape.

Flags:

  • -c Create a new archive
  • -v Verbose — show progress while archiving
  • -p Preserve permissions — keeps original file permissions
  • -z Compress using gzip
  • -f File name — expects a filename right after this flag
  • -I compressor
  • -p preserve file permissions
tar -cvf --exclude='.cache' --exclude='Cache'  --exclude='.cache' --exclude='.tmp' --exclude='tmp' /tmp/filename.tar.gz \
$source_path_to_tar


#(Parallel Implementation of Gzip) to to create a fast, compressed archive
tar -I pigz -cvf - /fileserver/media/music/*

# splits the output into 8GB chunks,
tar -I pigz -cvf - /sourcefolder/* | split --bytes=8GB - /tmp/file.tar.gz
```## Visual Linux


```bash
tar -cvpzf "/vault/.backups/devices/homeserver/tar/backup_$(date +"%Y%m%d%H%M%S").tar.gz \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/run \
--exclude=/media \
--one-file-system \
/

Users, Groups, and File permissions

#create
useradd USERNAME
# create with home directory
useradd -m USERNAME

#remove
userdel USERNAME
#useradd -r USERNAME
passwd
passwd USERNAME
groups
groupadd GROUPNAME
groups USERNAME
usermod -a -G GROUPNAME USERNAME

Network Configuration

hostname / hostnamectl


#get hostname
hostname

#set hostname
hostnamectl

sudo nano /etc/hostname
#alterar o nome
sudo nano /etc/hosts
#alterar o nome
Static IP
A configuração para um ip estático poderá ser um pouco diferente de distribuição para distribuição mas a lógica é similar

static ip

Debian sudo nano /etc/network/interfaces Exemplo de configuração

# neste exemplo de configuração a place de rede tem o nome enxd0374555c1f8 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

allow-hotplug enxd0374555c1f8
iface enxd0374555c1f8 inet static
  address 192.168.0.2
  netmask 255.255.255.0
  gateway 192.168.0.1
  dns-nameservers 89.207.128.252 89.207.130.252
Reiniciar configuração sem reboot de computador
# restart configuration servicce
sudo /etc/init.d/networking restart

System Monitoring Utilities

btop

Install Debian & Ubuntu:

apt update && apt install btop -y

Storage

Disk Space and Used

df -h

Physical Disks and Partition

List physical disks and partition size:

lsblk

Get Partition id:

blkid /dev/sdX
Partition Manager
fdisk /dev/sdX

check for file systems.

hdparm

hdparm is a powerful command-line utility in Linux used to view and configure low-level parameters of SATA, IDE, and some USB hard drives. Its commonly used for performance tuning, diagnostics, and power management.

sudo apt install hdparm
sudo hdparm -Tt /dev/sdc

smartctl

smartctl is a command-line utility used to monitor and manage the health of storage devices like HDDs and SSDs using S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology).

Heres a deeper look at what smartctl does and why its useful:

#check smart status
smartctl -a /dev/sdX
df
df -h
du -h --max-depth=1

Network Storage

smb

smb share

Create credentials file

#/home/mf/.credentials/smb:mf@nas.lan
username=shareuser
password=sharepassword
domain=domain_or_workgroupname

Secure credentials file permission

chmod 0600 /home/mf/.credentials/smb:mf@nas.lan

Add line

#/etc/fstab
//nas.lan/homes /mnt/smb-share:mf@nas.lan,share=homes cifs credentials=/home/mf/.credentials/smb:mf@nas.lan,uid=1000,gid=1000,nofail 0 0

gio

mount samba share:

#/home/username/.credentials
#username
#SAMBA
#password
gio mount smb://server/share < /home/username/.credentials

unmount:

gio mount -u smb://server/share

CLI Diagnostics and System Topology

lspci

Displays information about each PCI bus on your system. This includes information about the devices connected to the PCI subsystem.

lspci [options]

Option Description
-v Verbose
lspci -v