Files
Encoding
iconv -f cp1251 -t utf8
file -bi
Determine file type
file file_name
Display file or file system information
stat <file path|filesystem path>
Display ELF-file information
readelf -a <file path|filesystem path>
Show header of file
cat /usr/bin/python3.9 | hexdump -C | head
Compare files
comm
diff
Merge files
paste
Clean file
truncate -s 0 <file_name>
echo '' > <file_name>
> <file_name>
cat /dev/null > <file_name>
true | tee <file_name>
dd if=/dev/null of=<file_name>
shred <file_name>
shred -zu <file_name>
Translate or delete characters
tr
Show inodes
ls -i <file path>
Show file system where file
df <file path>
Print the locate of binary
type -a command
whereis command
which command
command -v command
Show all symbols
cat -A file_name
Find changed files use md5
find . -type f -exec md5sum {} \; > checklist.chk
md5sum -c checklist.chk
Display in hexadecimal
hexdump -C
xdd
Output starting with byte
tail -c +<number of bytes> <file name>
Display the assembler mnemonics for the machine instructions
objdump -d <file name>
find -name *.c -type f | xargs grep open
grep -R open --include="*.c".
Show shared object dependencies
ldd /path_to_object
Create archive
tar -cvpzf archive.tar.gz /forpack
Unpack archive
tar -xzvf archive.tar.gz
tar -xfvj archive.tar.bz2 -C /var/www
View archive
tar -tf archive.tar
tree -d -L 2
Replace in all files
sed -i 's/old_text/new_text/g' *
Print only matching parts
grep -Eo "pattern" file | sort | uniq
Copy with attributes mode, ownership, timestamps
cp -rp /source /destination
Copy with save all parameters
cp -a /source /destination
Backup
cp <file name>.txt{,.bak}
Overwrite a file and delete
shred -zvu -n 10 file_name
Overwrite a file
shred -zv -n 10 file_name
Overwrite a partition
shred -fvz /dev/sdXX
Terminate tail when process over
tail -f <file name> --pid=<PID>
Wait when file exist
tail -f <file name> --retry