diff --git a/cheatsheets/dd b/cheatsheets/dd new file mode 100644 index 0000000..c1db5f3 --- /dev/null +++ b/cheatsheets/dd @@ -0,0 +1,4 @@ +# Read from {/dev/urandom} 2*512 Bytes and put it into {/tmp/test.txt} +# Note: At the first iteration, we read 512 Bytes. +# Note: At the second iteration, we read 512 Bytes. +dd if=/dev/urandom of=/tmp/test.txt count=512 bs=2 diff --git a/cheatsheets/gcc b/cheatsheets/gcc index fa8b245..28a78c0 100644 --- a/cheatsheets/gcc +++ b/cheatsheets/gcc @@ -6,3 +6,16 @@ gcc -o file file.c # Debug symbols gcc -g + +# Debug with all symbols. +gcc -ggdb3 + +# Build for 64 bytes +gcc -m64 + +# Include the directory {/usr/include/myPersonnal/lib/} to the list of path for #include <....> +# With this option, no warning / error will be reported for the files in {/usr/include/myPersonnal/lib/} +gcc -isystem /usr/include/myPersonnal/lib/ + +# Build a GUI for windows (Mingw) (Will disable the term/console) +gcc -mwindows diff --git a/cheatsheets/grep b/cheatsheets/grep index cd79eb5..aeb2de3 100644 --- a/cheatsheets/grep +++ b/cheatsheets/grep @@ -9,3 +9,7 @@ grep -R pattern folder # Getting pattern from file (one by line): grep -f pattern_file file + +# Find all files who contain {pattern} in the directory {directory}. +# This will show: "file:line my research" +grep -rnw 'directory' -e "pattern" diff --git a/cheatsheets/netstat b/cheatsheets/netstat index c479fae..d932ab2 100644 --- a/cheatsheets/netstat +++ b/cheatsheets/netstat @@ -1,3 +1,5 @@ +# WARNING ! netstat is deprecated. Look below. + # To view which users/processes are listening to which ports: sudo netstat -lnptu @@ -11,3 +13,16 @@ Example output: 1507/python # Fast display of ipv4 tcp listening programs sudo netstat -vtlnp --listening -4 + +# WARNING ! netstat is deprecated. +# Replace it by: +ss + +# For netstat-r +ip route + +# For netstat -i +ip -s link + +# For netstat-g +ip maddr diff --git a/cheatsheets/python b/cheatsheets/python new file mode 100644 index 0000000..498cd15 --- /dev/null +++ b/cheatsheets/python @@ -0,0 +1,13 @@ +# Desc: Python is a high-level programming language. + +# Basic example of server with python +# Will start a Web Server in the current directory on port 8000 +# go to http://127.0.0.1:8000 + +# Python v2.7 +python -m SimpleHTTPServer +# Python 3 +python -m http.server 8000 + +# SMTP-Server for debugging, messages will be discarded, and printed on stdout. +python -m smtpd -n -c DebuggingServer localhost:1025 diff --git a/cheatsheets/wget b/cheatsheets/wget index 0ba5a3c..d0bcd7b 100644 --- a/cheatsheets/wget +++ b/cheatsheets/wget @@ -10,11 +10,14 @@ wget -c http://path.to.the/file # To download multiples files with multiple URLs wget URL1 URL2 -# To parse a file that contains a list of URLs to fetch each one +# To parse a file that contains a list of URLs to fetch each one wget -i url_list.txt -# To download files according to a pattern +# To download files according to a pattern wget http://www.myserver.com/files-{1..15}.tar.bz2 # To download all the files in a directory with a specific extension if directory indexing is enabled wget -r -l1 -A.extension http://myserver.com/directory + +# Allows you to download just the headers of responses (-S --spider) and display them on Stdout (-O -). +wget -S --spider -O - http://google.com