-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands
executable file
·50 lines (33 loc) · 959 Bytes
/
commands
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
Expansions
Brace expansion
touch {apple, banana, orange}
touch file_{1..100}
with zero padding: touch file_{01..100}
echo {1..10..2}
get numbers between 1 and 10, counting by 2.
echo {A..z}
echo {w..d..2}
Number of output
ls -1 | wc -l
View top and bottom of file:
head
tail
cp -v * ../otherfolder 1>../success.txt 2>../error.txt
1 and 2 represent standard output and standard error respectively.
> indicates redirecting them somewhere else.
Also:
cp -v * ../otherfolder &>../log.txt (Same thing as earlier)
bitbucket:
ls > /dev/null
Using awk to just get a column (12)
grep -i break-in auth.log | awk {'print $12'}
Set ping count
ping -c 1
Get response time only from ping result
ping -c 1 example.com | grep 'bytes from' | cut -d = -f 4
BASH Script
declare -i a=123 (integer)
declare -r b=123 (read only)
declare -l c="ABCD" (convert to lower case)
declare -u d="abcd" (convert to upper case)
tldp.org/LDP/abs/html/internalvariables.html