From 79a091a275c3fff90ded97539b96b8b9be47f9c5 Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Wed, 28 Aug 2013 11:15:59 +0100 Subject: [PATCH 1/4] added new examples for find --- cheatsheets/find | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cheatsheets/find b/cheatsheets/find index a78583a..14fad01 100644 --- a/cheatsheets/find +++ b/cheatsheets/find @@ -1,4 +1,4 @@ -# To find files by extension (ex: .jpg): +# To find files by cas insensitive extension (ex: .jpg, .JPG, .jpG): find . -iname "*.jpg" # To find directories: @@ -12,3 +12,13 @@ find . -type f -perm 777 # To find files with setuid bit set: find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l + +# To find files with extension '.txt' and remove them: +find ./path/ -name '*.txt' -exec rm {} \; + +# To find files with extension '.txt' and look for a string into them: +find ./path/ -name '*.txt' | xargs grep 'string' + +# To find files with size bigger than 5 Mb and sort them by size: +find ./ -size +5M -type f -print0 | xargs -0 ls -Ssh + From 4f83172647629e37823e76d785f77f051b25e60d Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Wed, 28 Aug 2013 11:22:30 +0100 Subject: [PATCH 2/4] added examples for pdftk (manipulating pdf files) --- cheatsheets/pdftk | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cheatsheets/pdftk diff --git a/cheatsheets/pdftk b/cheatsheets/pdftk new file mode 100644 index 0000000..d4d2ec2 --- /dev/null +++ b/cheatsheets/pdftk @@ -0,0 +1,6 @@ +# Concatenate all pdf files into one: +pdftk *.pdf cat output all.pdf + +# Concatenate pages 1 to 5 of first.pdf with page 3 of second.pdf +pdftk A=fist.pdf B=second.pdf cat A1-5 B3 output new.pdf + From dfc7c98607109466d1c72231ad5d4f6c0bf8373e Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Wed, 28 Aug 2013 11:24:32 +0100 Subject: [PATCH 3/4] added example for the gs command (reduce pdf file) --- cheatsheets/gs | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 cheatsheets/gs diff --git a/cheatsheets/gs b/cheatsheets/gs new file mode 100644 index 0000000..a62ac97 --- /dev/null +++ b/cheatsheets/gs @@ -0,0 +1,3 @@ +# To reduce the size of a pdf file: +gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf + From a66f3d1c15b9bc65fc5334828c535f97ed65a2fa Mon Sep 17 00:00:00 2001 From: Pierre Poulain Date: Wed, 28 Aug 2013 11:27:44 +0100 Subject: [PATCH 4/4] corrected typo for a better management of files with space in their name --- cheatsheets/find | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheatsheets/find b/cheatsheets/find index 14fad01..91d4e86 100644 --- a/cheatsheets/find +++ b/cheatsheets/find @@ -14,7 +14,7 @@ find . -type f -perm 777 find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l # To find files with extension '.txt' and remove them: -find ./path/ -name '*.txt' -exec rm {} \; +find ./path/ -name '*.txt' -exec rm '{}' \; # To find files with extension '.txt' and look for a string into them: find ./path/ -name '*.txt' | xargs grep 'string'