Question | Answer |
Display free space in the partition holding specifies directory | df |
df Options: Human readable format (bytes, KB, MB, GB) | df -h |
df Options: inode info | df -i |
df Options: Limit list to Local file system | df -l |
df Options: Displays filesystem type info | df -T, or --print-type |
Displays FILES and FILE SIZES in a below a specified directory (recursive by nature) | du |
du Options: Lists a total amount of space taken up for the directory | du -c |
du Options: Human readable format (bytes, KB, MB, GB) | du -h |
du Options: Lists only the total, not each file | du -s |
Displays open files in file system | lsof |
lsof Options: Lists all files for processes that are executing the specified command | lsof -c Command _Name |
lsof Options: List open files owned by the specified user | lsof -u |
lsof Options: Lists files opened by a specific process | lsof -g process_ID |
lsof Options: Recursively list files in a directory | lsof +D directory_name |
lsof Options: Size of files | lsof --s |
Display the PID’s of processes that are accessing a specified file or file system | fuser |
fuser Options: Displays all process ID’s | fuser -a |
fuser Options: Extended information (verbose) | fuser -v |
fuser Options: Appends the username to each process ID | fuser -u |
fuser Options: Displays process IDs in a specified directory | fuser -m |
Checks and optionally repair one or more Linux file systems – must be unmounted | fsck |
fsck Options: Serializes fsck when multiple filesystems are checked | fsck -s |
fsck Options: File type of file system to be checked | fsck -t
fsck -t ext2 /dev/sdb1 |
fsck Options: Automatically repairs without any questions | fsck -a |
fsck Options: Prompts for confirmation when errors found and asks permissions to fix errors | fsck -r |
Checks and optionally repair a 2nd extended file system (ext2) or ext2 file systems containing a journal (ext3) | e2fsck |
e2fsck Options: Forces a file system check even if filesystem appears clean | e2fsck -f |
e2fsck Options: Open filesystem as read-only and answer all question as “no” | e2fsck -n |
e2fsck Options: Repair without any questions | e2fsck -p |
e2fsck Options: Yes to all questions | e2fsck -y |
e2fsck Options: Use an alternative superblock id the primary superblock is corrupt | e2fsck -b |
Debugs the file system – examines and changes state of an ext2, ext3, or ext4 file | debugfs |
Allows administrators to unlink directories, change inode blocks, find all inodes that point to a block, and several other similar functions | debugfs |
debugfs Options: File system should be opened in read-write mode | debugfs -w |
debugfs Options: Open in catastrophic mode | debugfs -c |
debugfs Options: Executes commands in a text file | debugfs -f |
Print super block info for an ext2, ext3 or ext4 file system – info about each sector on partition about sector type, inode info, free blocks | dumpe2fs |
dumpe2fs Options: Print blocks reserved as bad in the file system | dumpe2fs -b |
dumpe2fs Options: Print only super block info | dumpe2fs -h |
dumpe2fs Options: Prints group info block numbers in hexadecimal format | dumpe2fs -x |
dumpe2fs Options: Force the utility to display the filesystem status irrespective of the filesystem flags | dumpe2fs -f |
Adjusts tunable parameters on ext2, ext3, and ext4 file systems – parameters include – volume label, reserved blocks, inode size, and journaling | tune2fs |
Implement access control – converts filesystem from ext2 to ext3 without affecting data on the drive | tune2fs |
tune2fs Options: Adjust the number of mounts after which the file system will be checked | tune2fs -c |
tune2fs Options: Remounts the filesystem as read-only | tune2fs -e remounts-ro |
tune2fs Options:Remount in PANIC mode | tune2fs -e panic |
tune2fs Options: Enables Posix access control list | tune2fs -o acl |
tune2fs Options: Converts ext2 file system to ext3 filesystem tune2fs –j /dev/sdb1 (without affecting data on drive) | tune2fs -j |
tune2fs Options: Specify the max time interval between filesystem checks (days, months, or weeks) | tune2fs -i d/mw |
tune2fs Options: Specify number of times filesystem can be mounted | tune2fs -C mount count |
tune2fs Options: List the contents within the superblock of the filesystem | tune2fs -l |
Display the XFS file system parameters, such as block size and inode structures – the same as xfs_grow –n | xfs_info |
Expand the xfs filesystem to fill the disk size | xfs_grow |
Repairs and recover a corrupt xfs filesystem | xfs_repair |
Debug the xfs filesystem | xfs_db |
Copy (dump) the metadata from an XFS filesystem to a file – does not alter the file system | xfs_metadump |
Use xfs_metadump to dump only: | Unmounted, read-only, or frozen filesystems |
xfs_metadump Options: Stop dumping the file system if there is a read error | xfs_metadump -e |
xfs_metadump Options:Displays the dump process | xfs_metadump -g |
xfs_metadump Options: Disables obfuscation of the file names and extended attributes | xfs_metadump -o |