Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 772 Bytes

bash.md

File metadata and controls

63 lines (41 loc) · 772 Bytes

Bash Script Cheats.

  1. counting lines in a file.
wc -l file_name
#with pipe
cat file_name | wc -l
  1. delete last line of file.
 | sed '$d'
  1. find files. that are recorded after time, and sort them
find location -newermt time -type f | sort
  1. Declare Bad Exit from bash.
 exit 1 
  1. Writing function bash
function_name(){


}

function function_name{

  
}
  1. Checking the size in linux. ref

Checking space untilization by directories on current level.

du -h -d1 .

To check disk space and utilization info.

// normal
df

// in megabyte and KB.
df -h
  1. grep, cut, sed.
ls | grep "cool" | sed "s/\/d/\/#d/" |