- Added instructions for downloading, extracting, and copying font files. - Included steps to update the font cache with explanations of `fc-cache` options.
6.0 KiB
Linux
Table of Contents
System Information
Hardware Information
To gather detailed information about your hardware, use the following commands:
lscpu: Displays information about the CPU architecture, including details about cores, threads, and CPU family.lshw: Provides a comprehensive listing of hardware components. Uselshw -shortfor a more concise view.hwinfo: Offers detailed information about hardware components and can be more verbose thanlshw.lsscsi: Lists SCSI devices, including disks and other SCSI-attached hardware.lsusb: Shows information about USB devices connected to your system.lsblk: Lists block devices such as hard drives and their partitions.df -H: Displays disk space usage in a human-readable format.fdisk -l: Lists all partitions on the system.dmidecode: Retrieves hardware information from the BIOS. Use:dmidecode -t processorfor CPU detailsdmidecode -t memoryfor RAM detailsdmidecode -t biosfor BIOS information
Software Information
Finding Path to Binary
To find the location of an executable binary, use:
type composer
This command will show the path to the composer executable if it's available in your PATH.
Number of Words in a File
To count the number of words in a file, use:
wc filepath
This command will show the number of words along with other details like lines and characters.
Number of Lines in a File
To count the number of lines in a file, use:
wc -l filepath
This command will display the number of lines in the specified file.
User Management
User Information
List Users
To list all users from the /etc/passwd file, use:
awk -F':' '{ print $1}' /etc/passwd | sort
This command extracts the usernames from the /etc/passwd file and sorts them in alphabetical order.
Super User Management
Disable Root Login
To disable root login via SSH, perform the following steps:
-
Edit the SSH Configuration File:
nano /etc/ssh/sshd_configComment out the line containing
PermitRootLoginby adding a#at the beginning of the line. -
Change Shell for Root User:
nano /etc/passwdFind the line starting with
rootand change/bin/bashto/sbin/nologinto disable login for the root user.Save and close the file. Restart the SSH service for changes to take effect:
systemctl restart ssh
Sudo Management
Add User to Sudo Group
adduser fabrice sudo
Update Sudoers File to Remove Password Requirement
Edit the sudoers file:
visudo
Add the following line to allow the user to execute commands without a password:
fabrice ALL=(ALL) NOPASSWD:ALL
Switch User
Switch to Another User as Sudoer
sudo -i -u postgres
This command switches to the postgres user with sudo privileges.
Switch to Another User as Root
su - postgres
This command switches to the postgres user with root privileges.
USB Devices
Test USB Key
Device Information
Check if the system recognizes the device and show the latest system messages related to USB devices being connected:
lsusb
dmesg | tail -n 20
Find Mount Points and Device Information
Identify mount points, partitions, and other relevant details of mounted devices:
lsblk -f
df -h | grep /dev/sdc
findmnt /dev/sdc1
mount | grep /dev/sd
Print Detailed Information About the USB Key
View detailed partition and disk information:
fdisk -l /dev/sdc
Test the File System
Check and repair the filesystem on the USB key:
fsck /dev/sdc1
Test Data Integrity
Perform read/write tests to ensure the integrity of the USB key:
-
Unmount the USB Key (if mounted):
umount /media/fabrice/BD48-F8BB -
Write Test:
dd if=/dev/zero of=/dev/sdc bs=4M count=256 status=progress -
Read Test:
dd if=/dev/sdc of=/dev/null bs=4M count=256 status=progress
Check for Bad Blocks
Identify any bad sectors on the USB key:
-
Read-only test:
badblocks -v /dev/sdc -
Non-destructive read-write test:
badblocks -nsv /dev/sdc- The
-noption performs a non-destructive read-write test. - The
-soption shows progress. - The
-voption is for verbose output.
- The
Perform a SMART Test
Run SMART diagnostics to test the health of the USB key:
-
Start a short SMART test:
smartctl -t short /dev/sdc -
View test results:
smartctl -a /dev/sdc
Benchmark the Speed
Measure the read speed of the USB key:
hdparm -t /dev/sdc
Unmount and Safely Remove
Unmount the USB key and safely remove it from the system:
umount /mnt/usb
eject /dev/sdc
Fonts
Download and Install Fonts
-
Download the Font Archive:
wget https://path/to/font/archive.tar.gz -
Extract the Font Files:
tar -xzvf font-archive.tar.gz -
Copy the Font Files to the Local Fonts Directory:
cp -v *.ttf ~/.local/share/fonts/
Update the Font Cache
Force a Reload of the Installed Font Cache:
sudo su -
fc-cache -fv
fc-cache -frv
-f: Force re-generation of apparently up-to-date cache files, overriding the timestamp checking.-r: Erase all existing cache files and rescan.-v: Display status information while busy.