-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlinuxcmds.txt
69 lines (53 loc) · 3.13 KB
/
linuxcmds.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ Convert lower case to upper case
tr '{}' '()' < inputfile > outputfile Translate braces into parenthesis
echo "This is for testing" | tr [:space:] '\t' Translate white-space to tabs
echo "This is for testing" | tr -s [:space:]
Squeeze repetition of characters using -s
echo "the geek stuff" | tr -d 't' Delete specified characters using -d option
echo "my username is 432234" | tr -cd [:digit:] Complement the sets using -c option
tr -cd [:print:] < file.txt Remove all non-printable character from a file
tr -s '\n' ' ' < file.txt Join all the lines in a file into a single line
traceroute -T oracle_host -p jdbc_port
ldap
/usr/sbin/slapd -h "ldapi:/// ldap:///" -d stats &
host--dns resolve linux
nslookup-- dns resolve win
Show current routing table $ route –n or ip route
Add static route $ route add -net address or ip route add
Delete static route $ route del -net address or ip route del
ethtool--- Queries network interfaces and can also set various parameters such as the speed
netstat------ Displays all active connections and routing tables. Useful for monitoring performance and troubleshooting
nmap---------Scans open ports on a network. Important for security analysis
tcpdump -----Dumps network traffic for analysis
iptraf ----Monitors network traffic in text mode
mtr ---------Combines functionality of ping and traceroute and gives a continuously updated display
dig -----------Tests DNS workings. A good replacement for host and nslookup
curl ifconfig.co----public ip from server
if statement
-e file Checks if the file exists.
-d file Checks if the file is a directory.
-f file Checks if the file is a regular file (i.e. not a symbolic link, device node, directory, etc.)
-s file Checks if the file is of non-zero size.
-g file Checks if the file has sgid set.
-u file Checks if the file has suid set.
-r file Checks if the file is readable.
-w file Checks if the file is writable.
-x file Checks if the file is executable.
-n
string is not null.
-z
string is null, that is, has zero length
echo ` hostname -f ` `pip3 list installed|grep six ` ` date `
echo $(hostname -f) $(pip3 list installed|grep six) $(date)
both giv same output - <hostanme> six (1.10.0) <date command output> - in one line
to change the max number of pids use command - sudo sysctl -w kernel.pid_max=4194304
u can chk this is in file /proc/sys/kernel/pid_max
command to check the ip of the machine the user logged in from - last <username>|grep "still"
command to check the ip of the machine the user logged in from - last <username>|grep "still" - this will giv u ip
to get teh hostname from ip - nslookup <ip> or dig -x ip
#find /home/daygeek/shell-script -type f -mtime -15 -ls - to list files that are modified from 15 days
#ps -Ao user,uid,comm,pid,pcpu,args --sort=-pcpu | head -n 6 - to check process with high cpu
#find / -size +1M -exec du -sh {} \ - to list files and file sizes of files grated than 1 mb
#nethogs -a - to monitor the network usage by a process
#nload - to monitor network traffic on a node
#htop - better than top