Skip to content
cheatsheet
home
/
cv
/
weblog
/
cheatsheet
/
proxy
/
vpn
/
status
/
links
EN
RU
☾
New version available
reload
×
cheatsheet
/
linux
/
Sum a column with awk
Sum a column with awk
linux
Sum values in column 2 of a text file
awk '{sum += $2} END {print sum}' file.txt
⎘ copy
#linux
more linux
all 133 commands →
Delete lines matching pattern
sed -i '/^#/d' config.conf
Multi-line sed replacement
sed -n '/START/,/END/p' file.txt
Unique sorted values
sort file.txt | uniq -c | sort -rn
Show users logged in
who -H && w
Last logins
last -n 20 | head -25