lsattr — List Linux File Attributes
Practical lsattr examples for checking extended Linux file attributes such as immutable files.
Practical lsattr examples for checking extended Linux file attributes such as immutable files.
Practical chattr examples for setting and removing Linux file attributes such as immutable files.
Linux can read many different file systems, but support depends on the kernel, installed packages and whether the file system was cleanly unmounted. Identify the device and file system This shows block devices, mount points and detected file system types. Create a mount point Mount read-only first Mounting read-only is safer when checking an unknown, … Read more
When a Linux machine has more than one network card, the first step is to confirm that the kernel can see each device. List network interfaces This shows interfaces such as eth0, eth1, ens33 or enp0s3, depending on the Linux distribution and naming scheme. Check PCI network hardware Check driver messages If a card is … Read more
Resizing a Linux filesystem can be useful when a partition or logical volume has become too small, but it should be treated as a careful maintenance task rather than a routine command. Check the current layout These commands help confirm the device name, mount point and filesystem type before making any change. Important safety notes … Read more
Bash scripts often need to read command-line arguments. For simple scripts, you can use positional parameters such as $1, $2 and $@. Simple positional arguments Loop through all arguments Basic option handling getopts is useful for small scripts that need flags such as -v or options with values such as -f file.txt.
aspell is a command-line spell checker. It is useful when editing plain text files, notes, documentation or scripts where you want a quick spelling pass without opening a full word processor. Check a text file This opens an interactive spelling session for the file. List possible misspellings This prints words that aspell thinks may be … Read more
Shell redirection operators control where command input and output go. They are useful for saving command output, appending logs, and passing one command’s output into another command. Write output to a file > writes output to a file. It replaces the existing file contents. Append output to a file >> appends output to the end … Read more
DNS search domains let a Linux system resolve short hostnames by automatically appending one or more domain names. Example If the search domain is example.com, a lookup for server1 may also try server1.example.com. Check resolver configuration You may see lines such as: Test name resolution On many modern distributions, /etc/resolv.conf may be managed by NetworkManager, … Read more
mpstat reports CPU usage statistics. It is useful when you want to see whether load is spread across processors or concentrated on one CPU. Show CPU statistics Refresh every few seconds Show each processor separately On many systems, mpstat is provided by the sysstat package.