Skip to content

hannaj06/Linux-Tricks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 

Repository files navigation

number of lines in a file or directory:

wc -l <file_name>

wc -l *

split large text file into smaller ones

split [-l line count] [-b byte count] [file name]

sample:

split -l 100000 long.txt

output:

xaa
xab

system disk space usage:

df -h

estimate usage of a set of files recursively

du -h

sample:

365M	./logs/dag_processor_manager
449M	./logs
450M	.

file sizes in a directory:

ll -sh

combining files

cat file_a.txt file_b.txt file_c.txt > merged.txt

combining multi part s3 files:

cat <file_name_prexfix>*_part.txt >merged_file

deduplicate file:

sort long_list.txt | uniq > output_file.txt

search and replace

sed 's/<phrase_a>/<phrase_b>/g' file.txt > output_file.txt

appending a file to another file

cat file_a >> file_b

get known host public key

ssh-keyscan -t rsa <host>

turn off computer

shutdowwn now

About

Linux cheat codes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published