Skip to content

Instantly share code, notes, and snippets.

@Keiku
Last active March 13, 2023 10:40
Show Gist options
  • Save Keiku/4e4799dbcb92b214d2f66d579d1668f8 to your computer and use it in GitHub Desktop.
Save Keiku/4e4799dbcb92b214d2f66d579d1668f8 to your computer and use it in GitHub Desktop.
A list of linux commands.
# compress/decompress zip file.
zip file.csv.zip file.csv
unzip file.csv.zip
# compress/decompress gz file.
gzip file.csv
gzip -d file.csv.gz
# compress/decompress bz2 file.
bzip2 file.csv
bzip2 -d file.csv.bz2
# compress/decompress tar.gz file.
tar zcvf file.csv.tar.gz file.csv
tar zxvf file.csv.tar.gz
# compress/decompress tar.bz2 file.
tar jcvf file.csv.tar.bz2 file.csv
tar jxvf file.csv.tar.bz2
# compress/decompress 7z file
7z a file.7z file1.csv file2.csv
7z x file.7z
# repair zip file.
zip -FF file.zip --output file_repaired.zip
# split a file.(output file.aa, file.ab).
split -b 100M file.tsv.bz2 file.
# conbine some files.
cat file.aa file.ab > file.tsv.bz2
# check the process with high memory usage.
ps alx | awk '{printf ("%d\t%s\n", $8,$13)}' | sort -nr | head -10
# check the number of cores.
cat /proc/cpuinfo | grep -c "processor"
# find files and remove them.
find ./ -type f -name "*.txt" -print0 | xargs -0 rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment