☁️
Cloudflare Guides
  • WAF (Web Application Firewall)
    • Guides
      • Log Guide
        • Page 6
        • Page 1
        • Page 2
        • Page 4
      • Block Guide
        • Block a Browser
        • Block a Country
        • Block a Continent
        • Block by IP Address
      • Managed Challenges Guide
        • Managed Challenge IP Range
        • Managed Challenge Browser
        • Managed Challenge Continent
        • Managed Challenge Country
      • Legacy Captcha Guide
        • Legacy CAPTCHA IP Address
        • Legacy CAPTCHA for Country
        • Legacy CAPTCHA by Browser
        • Legacy CAPTCHA Continent
      • Rate Limiting Guide
      • Bots Guide
  • DNS Guide
  • Speed Optimization
  • Fundamentals
  • Network Linux Commands
  • WireShark
  • SSL/TLS
  • DNS Query
Powered by GitBook
On this page
  • tail
  • Curl
  • grep
  • dig
  • cd
  • telnet
  • cat
  • wget
  • PWD
  • echo
  • cp
  • df
  • free -mh
  • htop
  • top -c
  • awk
  • sed
  • netstat
  • mtr [Domain]
  • strace -p [PROCESSID]
  • alias [alias]="[command]"

Network Linux Commands

Networking Commands for Situations

tail

Print the last N number of data of given input. By default, it will print the last 10 lines of the specified file.

Syntax: tail [OPTION] [FILE]

Short Option
Long Option
Syntax
Description

-n

--lines

tail -n [number] [filename]

Specify number of lines

-c

--bytes

tail -c [+/- number] [FILENAME]

Prints the last 'num' bytes (pos or neg number)

-q

--quiet

tail -q [FILENAME] [FILENAME]

Data from each file is not preceded by its file name.

-v

--verbose

tail -v [FILENAME]

Data from specified file is always preceded by filename.

-f

--follow

tail -f [FILENAME]

Follow live updates to file.

Curl

grep

Grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern.

Syntax: grep [OPTION] [pattern] [FILENAME]

Options
Description

-c

Prints count of the lines that match a pattern.

-h

Display the matched lines, do not display the filenames.

-i

Ignores, case for matching.

-l

Displays list of filenames only.

-n

Display the matched lines and line numbers.

-v

Prints out all the lines that don't match the pattern.

-e

Specifies expression with this option (Can be

used multiple times)

-f

Takes patterns from file, one per line.

-E

Treats patten as an extended regular expression.

-w

Match whole word.

-o

Print only the matched parts of a matching line, with each on a seperate output line.

-A n

Prints searched line and n(lines) after the results.

-B n

Prints searched line and n(lines) before the result.

-C n

Prints searched line and n(lines) after before the results.

dig

Finds DNS Information

Syntax: dig [SERVER] [NAME] [TYPE]

Option
Description

+short

Displays short answer option

+noall +answer

To access detailed info on the answers section.

+trace

Displays each different server the query goes through.

-x

Look up using IP Address

cd

Change directory

Syntax: cd [DIRECTORY]

Option
Description

/

Change to the root directory.

~

Change to the home directory.

..

Move to the parent directory.

"dir name" or dir\ name

Navigate to a directory with white spaces.

telnet

call IP address with a specific port

Syntax: telnet [IP Address] [PORT]

cat

Displays file content on output.

Syntax: cat [filename]

wget

Stands for Web Get. It downloads a file from the internet.

wget [OPTION] [URL]

Option
Description

-b

Download in the background.

-o

Overwrite the log while

PWD

Prints current working directory

Syntax: pwd [Options]

Option
Description

-L

Prints logical directory.

-P

Prints actual working directory.

echo

Echo is used to display of line of text/string that is passed as an argument.

Syntax: echo[OPTION] [STRING]

Backslash escapes

\b: removes all spaces

\c: suppress trailing new line

\n: create new line

\t: adds tab

\r: Returns everything after r

\v: add vertical tab

Option
Description

-e

Enables the interpretation of backslash escapes

*

works the same way as ls

-n

used to omit trailing newline

cp

CP stands for copy. Used to copy files or groups of files or directory.

Syntax:

cp [OPTION] [SOURCE] [DESTINATION]

cp [OPTION] [SOURCE] [DIRECTORY]

cp [OPTION][SOURCE1] [SOURCE2]-n [DESTINATION]

Option
Description

-i

Systems first warns user before overwriting the destination file.

-b

This option creates the backup of the destination file in the same folder with a different name and in a different format.

-f

Used if user doesn't have writing permission. It will delete destination file first then copy of content is done from source to destination.

-r or -R

df

check disk space

Syntax: df [option]

-h: human readable format

free -mh

check ram

htop

check cpu

top -c

check cpu (old version)

awk

find specific columns

Syntax: awk '{print __}' [file]

sed

FInd and replace, insertion or deletion. Most common use of sed is find and replace.

Syntax: sed [OPTIONS] [Script] [INPUTFILE]

\1: first occurance

\2: second occurance

\g: global replace

sed 'n s/word1/word2/' [FILE]

netstat

netstat -p IP output: list of all connections for the PHv4 protocol

netstat -s -p icmpv6 output: list all statistics on the ICMPv6 protocol.

netstat -ano output: display all open ports and active connections (numeric and process ID included)

netstat -a | less output: shows all the connected and waiting sockets in a easier way to read

netstat -at | less output: see only the TCP sockets.

netstat -au | less output see only UDP sockets.

netstat -l | less out output: sockets that are in the listening state. (can be combined with -t and -u)

netstat -st | less output: statistics for TCP

netstat -su | less output: statistics for UDP

netstat -r output: routing table

mtr [Domain]

live traceroute

strace -p [PROCESSID]

alias [alias]="[command]"

You can also nano into

PreviousSpeed OptimizationNextWireShark

Last updated 2 years ago