Common Linux Command Lines

From ZENWorks Wiki

Jump to: navigation, search

Find all symbolic links to a file. The following command will search from / (Which is root of everything) for anything linking to testfile

The following command will search from / (Which is root of everything) for anything linking to testfile
Linux:> find / -lname /etc/init.d/testfile
/home/jjennings/linkfile

Run a Linux Command every specified number of seconds. This is very useful when wanting to monitor a process or a log file. Syntax is "watch "the command you want to execute"

Using Watch
Linux:> watch cat /proc/meminfo
MemFree: 315952 kB


Load a process and be able to kill the window, but not kill the process
Linux:> /usr/stoneware/bin/webNetwork & 2> /dev/null
Process Started


Mount a folder, drive, or share located on a Windows box to a point on the Linux Box.

Execute a Command every X number of Seconds
Linux:> nice -n <seconds> <command>
Command Output
Mount Windows Share
Linux:> mount -t cifs //172.16.1.217/c$ /mnt/drive/ -o user=administrator,password=my_password
Mounted
Search the contents of files for a string
Linux:> find <path> -type f -exec grep -H "string" '{}' \;
Finds that match the string

Prepare the kernel for vmware or other applications that require the kernel source.

I really like using these commands for VMware and the FGLRX drivers. Using this method, I do not need to compile the kernel.

Prepare Kernel Source
Linux:>

cd /usr/src/linux make mrproper make cloneconfig make modules_prepare
Finished


ARP tools

arping -I eth0 -c 3 10.10.20.67
Linux:> arping -I eth0 -c 3 10.10.20.67

ARPING 10.10.20.67 from 10.10.20.33 eth0 Unicast reply from 10.10.20.67 [00:80:C8:7E:71:D4] 11.298ms Unicast reply from 10.10.20.67 [00:80:C8:E8:1E:FC] 12.077ms Unicast reply from 10.10.20.67 [00:80:C8:E8:1E:FC] 1.542ms Unicast reply from 10.10.20.67 [00:80:C8:E8:1E:FC] 1.547ms Sent 3 probes (1 broadcast(s)) Received 4 response(s)

ARP Cache Timeout
Linux:> ip neighbor show 192.168.99.7

192.168.99.7 dev eth0 lladdr 00:80:c8:e8:1e:fc nud reachable

ARP Cache
Linux:> arp -e
Address HWtype HWaddress Flags Mask Iface

192.168.1.1 ether 00:01:E7:48:E4:33 C eth1

192.168.1.2 ether 00:01:E7:48:E4:33 C eth1

192.168.1.3 ether 00:01:E7:48:E4:33 C eth1

server1.domain.com (incomplete) eth1

server2.domain.com ether 00:0B:CD:F1:18:FF C eth1

Personal tools