Linux Command Reference

General Commands

Network

Command Description OS
# nmtui Start network management UI. C7
# systemctl start/stop/restart network Network service control. C7
# systemctl stop firewalld Stop Firewalld service. C7
# systemctl disable firewalld Disable Firewall service. C7
# /etc/rc.d/init.d/network start Network service control. C6
# source .bashrc Apply .bashrc setting. C7,C6,U14
export http_proxy=http://proxyserver:8080 http proxy configuration in ~/.bashrc file C7,C6,U14
export https_proxy=http://proxyserver:8080 https proxy configuration in ~/.bashrc file C7,C6,U14
/etc/sysconfig/network-scripts/ifcfg-xxx
/etc/network/interfaces
Interface configuration file path. C7,C6
U14

Netstat / lsof

Command Description OS
# netstat -atun Show current port numbers in use.(TCP&UDP) C7
# netstat -atn Show current port numbers in use.(TCP only) C7
# netstat -aun Show current port numbers in use.(UDP only) C7
$ lsof -i tcp:80 Show active process with specified protocol and port number U12
$ kill -9 PID kill the process with specified PID U12

DNS (Client)

Command Description OS
>ipconfig /flushdns Clear DNS cash. win7

Time

Command Description OS
# date Show date and time.  etc. Tue Jul 26 21:15:34 2016 C7,U14

Version

Command Description OS
# cat /etc/redhat-release Show CentOS release version. C7
# arch Show architecture. (64bit or 32bit)  C7,U14
# uname -a Show hostname, architecture etc. C7,U14

File/Directory

Command Description tested OS
# cp -r sourcedir destdir Copy directory  C7
# rm -r -f directoryname remove folder and files within without asking C7
$ sudo rm -rf folderName remove directory and files within U14
$ sudo mv fromPath/directory toPath/ move directory U14
$ sudo mv oldFilename newFilename rename file U14

Search

Command Description OS
# find / -name filename find file or directory C7
# grep -rnw ‘/path/to/somewhere/’ -e ‘pattern’ find files that contains specific text U14

Disk

# df -h Check disk availability of each partition.

User

# sudo su – Switch to root. (Ubuntu)
# ls -l Show file permission.
# chmod 755 filename Change file permission. (rwx r-x r-x)

 

Application Commands

vi editor

Command Description
/string Search string specified.
n (N) Search next (previous).
:set number Display line number.

BIND

Command Description OS
# named -v Show BIND version. C7
# systemctl start named-chroot Start BIND (DNS) service. C7

xinetd (TFTP)

Command Description OS
# xinetd -version Show xinetd version. C7

Open vSwitch

# ovs-vsctl show Show bridge configuration.
# ovs-ofctl dump-flows bridgename Show openflow table.

Netns

# ip netns show Show netns instances.
# ip netns exec instancename ifconfig  Show interface configuration of specified instance.

FreeRADIUS

# /var/log/radius/radius.log FreeRADIUS log file path.