curl

Updated: 24 January 2026

Show only HTTP response code

curl -s -o /dev/null -w "%{http_code}\n" https://christaylordeveloper.co.uk

Ask for HTTP headers only

curl --head https://christaylordeveloper.co.uk

Write output to file instead of stdout

curl http://some.url --output <file>

Basic HTTP server authorisation

curl -u user:pass http://some.url
# or
curl http://user:pass@some.url

Make the operation more talkative

curl --verbose https://www.google.com

By default, every secure connection curl makes is verified to be secure before the transfer takes place. The --insecure option makes curl skip the verification step and proceed without checking.

curl --insecure https://www.example.com

Follow redirects

curl --location https://www.i-have-moved.com

Pretty print json response by piping through jq command

curl --insecure -X 'POST' \
    'https://localhost/authors' \
    -H 'accept: application/ld+json' \
    -H 'Content-Type: application/ld+json' \
    -d '{
  "Name": "string",
  "email": "string",
  "website": "string",
  "Twitter": "string"
}' | jq

find

Updated: 15 September 2025

Find all items called our_cron. Send error output to /dev/null, which hides error messages e.g. ‘Permission denied’

find -name our_cron 2> /dev/null

Find symbolic links, recursively down from the current directory

find . -type l

Find files in directory /tmp larger than 100MB

sudo find /tmp -type f -size +100M

Find directories with either foo or bar in their name

find . -type d \( -iname '*foo*' -or -iname '*bar*' \) | sort

Find files or directories with either lvim or lunarvim in their name

find . \( -iname '*lvim*' -or -iname '*lunarvim*' \)

Find files modified within the last 6hrs i.e. 0.25 of 1 day

find /home/chris -type f -mtime -0.25

Find files where name (case insensitive) matches ‘*.exe’

find ~/.nuget/packages -iname "*.exe"

Find directories where name starts with ‘site’

find . -type d -name 'site*'

Find any of the named files (risky, test first)

find this-dir -type f \( -name "foo" -o -name "bar" -o -name "log" \)

Find all files not in the git directory

find . -type f -not -path "./.git/*"

Find, but exclude multiple directories

find ~ -iname '*nvim*' ! -path '/path/one/*' ! -path '/path/two/*' ! -path '/path/three/*'

Find directories with name including let but search no more that 2 levels down

find -maxdepth 2 -type d -iname '*let*'

exec

find uses ; or + to terminate the -exec command. Therefore \; must be used because ; is one of the operators (also && or ||) which separates shell commands.

Find files by text in the file.

find . -type f -name "*.java" -exec grep -il string {} \;

-i: ignore case
-l: show filenames, not the match.

cp

Updated: 09 February 2025

Copy files and directories.


Copy the entire contents of a directory. Using a dot at the end of the source directory indicates that everything within the directory should be copied, including hidden files

cp -a /tmp/wordpress/. /var/www/wordpress

Copy and rename a file

cp program3.cpp homework6.cpp

Copy file into a folder

cp chris-taylor-cv.pdf marketing/
cp image.jpg folder/sameImageNewName.jpg

Preserve the file modify time, when copying

cp --preserve=timestamps ~/.tmux.conf ~/my-dot-files/