-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasic_commands.sh
More file actions
92 lines (76 loc) · 3.43 KB
/
Basic_commands.sh
File metadata and controls
92 lines (76 loc) · 3.43 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
# #### Here we have most basic linux command we use during day ####
# echo is for print message Or print enviroment variable value .
# Example ->
echo "Hello linux user"
echo $SHELL
echo $HISFILE
echo $PATH
echo $TZ
echo are you here \?
echo yes i\`m here
# pwd show your current working directory path.
# Example ->
echo "Your current working directory is :"
pwd
# cd for move your working directory to new location .
# Example ->
cd /var/log # change location to /var/log folder
cd ~ # change location to home directory
cd - # change your location to most recent working directory
cd ../ # change your location to the directory above the current directory
# type command for determine whether a command is external or internal
# Example ->
type echo # echo is a shell builtin
type python # python is /usr/bin/python
# set command show complete list of active enviroment
# Example ->
set
# which command search and find program location
# Example ->
which echo
# export command preserve an environment variable`s definition
# Example ->
export NEWVAR=123434
echo $NEWVAR # print 123434
# unset command for remove environment variable
# Example ->
unset NEWVAR
echo $NEWVAR
# man command have pages contain documentation on a command`s purpose
# Example ->
man uname
man -k pass # with -k option you have ability to search for keywords in the documentation.
# history command show list of commands you used before
# Example ->
history
echo $HISFILE # prints the history file location
# Note -> the history file will not have commands you have used during your current login session . if you desire to update the history file use following options
history -a # appends the current history list commands to end of the history file
history -n # appends the history commands from the current session to the current history list
history -r # overwrite the current history list commands with the commands stored in the history file
#how delete bash history
history -c # delete current session history
history -w # overwrites current blank history to bash history file
# ls is a command to list system files and directories.
# Example ->
ls # show current directory files .
ls /etc # show /etc folder files .
ls -l # show current directory files with more information like files type, permissions , size , modified time .
ls -lh # show current directory files with human readable size
# The xargs command is used in a UNIX shell to convert input from standard input into arguments to a command
# Example ->
ls -l files-*.txt | xargs -p /usr/bin/rm
# The uptime command is for a quick look at system load average and check system uptime .
# Example ->
uptime
# NOTE :
# The load average appears as three numbers: the 1-minute,5-minute and 15-minute load averages.
# It's not uncommon for the 1-minute load value to be high for short bursts pf activity.
# If the 15-minute load value is high . your system may be in trouble.
# The free command is for a quick look at memory usage.
# Example ->
free -h
# -h switch is for show sizes as human readable format
# The watch command is a handy little utility for monitoring process information
# Example ->
watch uptime # by default watch will reissue the command ever two seconds.