Skip to content

Common CLI commands


Copying files locally

rsync -avhW --no-compress --progress /src/ /dst/


Show only headers

curl has an option to display only headers using -I. This flag is better than using a combination of -s and redirecting the output to /dev/null or 2>&1 as it's easier to remember.

An important thing to note is that -I sends a HEAD request. As shown here:

$ curl -I  -vvvv 2>&1 | grep -C 3 'HEAD'
} [5 bytes data]
* Using Stream ID: 1 (easy handle 0x55dff1e30920)
} [5 bytes data]
> Host:
> user-agent: curl/7.76.1
> accept: */*

However it's easy to override the HTTP method using -X. For eg, to send a GET request but only display the headers:

curl -I -X GET -vvvv

Send a JSON payload from file

curl -i -XPOST -H "Content-Type: application/json" -d @mock_payload.json http://localhost:6000/endpoint


Set the editor

git config --global core.editor "vim"


Edit in place


Match only the word

\b in regex is used to match word boundaries (i.e. the location between the first word character and non-word character).

sed -i 's/\bsuper_specific_phrase\b/STRING_TO_REPLACE_IT/g' filename


Check for packets flowing out from an interface for a specific CIDR

sudo tcpdump -v -i wlo1 dst net
  • -i is for interface. wlo1 is the interface name.
  • dst specifies destination IP
  • net specifies it's a CIDR range.