Skip to content

Instantly share code, notes, and snippets.

@makanijatin
Last active January 25, 2019 03:00
Show Gist options
  • Save makanijatin/5b3631bf5cfaedf1bd7b15aa326421d7 to your computer and use it in GitHub Desktop.
Save makanijatin/5b3631bf5cfaedf1bd7b15aa326421d7 to your computer and use it in GitHub Desktop.

Networking

curl it is a tool to transfer data from and to a server using one of the supported protocol

 whois google.com #Whois is an easy way to find information on the owner, nameserver, registrar etc. of a domain name. 
 ping google.com # ping will check if you can actually reach the server or not
 curl http://example.com
 curl example.com
 curl -I -l -k or -Ilk example.com
 curl -l -v -k or -Ivk example.com
 -I   Include the HTTP-header in the output. it includes things like server name, date of doc, HTTP-version
 -k   --insecure  By default every connection curl makeis verfied to be secure
 -l   --list-only
 -v   --verbose
 
 traceroute google.com #journey of packet from source to destination
 dig google.com #this is the command to querying the domain name system
 dig google.com any # to query any type of the record
 dig +trace www.example.com
 
 nslookup -type=SRV  tesdfasfdafaf.local. #nslookup is also used for querying domain name system to obtain doamin name or public ip assocaited with that record

dig and host If you want to check that your DNS servers are being queried properly, you can use the host or dig

dig google.com
host google.com

view the content of /etc/bashrc to find the setting of the command prompt edit bashrc to make changes to the command prompt

/etc/profile /etc/bashrc ~/.bashrc

Packages yum

yum list installed | grep -i httpd24

grep #content of file single file or whole directory structure

grep PS1
grep -r PS1 . or grep -r PS1 /etc/
grep PS1 .bashrc
grep -i ****** #case insensitive
grep -l ****** #return file name instead of content
grep -nwr 'text-to-search' file-path (. for current directory)  # n - line number w - match whole word r - recursive search

Find #find by file name

find ~/locationtofind -name 'name' # -iname for exact search
-type f #for search only files
-type d #for search only directories
find ~/deployment-data-code/ -name test.config  -exec grep "yum" '{}' \; -print
find . -type f -print | xargs grep "example"
find . -name "*.bak" -delete 

Locate

locate pwd # it will give all the place wher it is stored

Storage

 df -h
 sudo du -csh # disk usage on linux

User

 adduser test #add new user test
passwd test #add password for new user test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment