Repository navigation
Expand file tree
/
Copy pathbash.bash
More file actions
125 lines (80 loc) · 1.72 KB
/
Copy pathbash.bash
File metadata and controls
125 lines (80 loc) · 1.72 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
bash - GNU Bourne-Again SHell
bash
history | awk '{$1=""}'1 | sort | uniq
# In Ubuntu/Debian os.
apt -y install bash
# In Redhat/Oracle linux upto 7th version only.
yum -y install bash
# In rhel8/oel8.
dnf -y install bash
# To enable tab completion.
# install "bash-completion" package
yum -y install bash-completion
apt -y install bash-completion
# -- single line comment.
: '
-- multiline comment
'
history -c # Clears the complete history.
# To set time on history.
HISTTIMEFORMAT="%Y-%m-%d %T "
unset HISTTIMEFORMAT
# To avoid command from being written in the history.
HISTCONTROL=ignoreboth
# Just add a space before typing an commands.
# [root@srv ~]# <space>ls
history -d <offset>
# To get the command only
history | cut -d " " -f5-
# default PS1 = [\u@\h \W]\$
# default PS2 = >
# Below are the parameters for the PSn variables.
# \u: The username.
# \h: The hostname.
# \w: The current working directory.
# \W: The basename of the current working directory.
# \t: The current time in 24-hour format (HH:MM:SS).
# \n: A newline.
# \d: Date
export PS1="\s-\v\$ "
# This command sets the PS1 variable to its default value.
# Where \u represents the username, \h represents the hostname, and \w represents the current working directory.
# The trailing \$ displays a $ symbol for a regular user or a # symbol for the root user.
export PS1='[\u@\h \t \w]\$ '
export PS1='[\u@\h \d \w]\$ '
man hier # Man page of the linux hierarchy.
alias
# To set shortcuts to commands.
alias random-keyword="COMMAND WITH ATTRIBUTES"
Example
alias ll="ls -alF"
# Index of Shell Reserved Words
!
[ ]
[[ ]]
{ }
# C
case
# D
do
done
# E
elif
else
esac
# F
fi
for
function
# I
if
in
# S
select
# T
then
time
# U
until
# W
while