Linux Administration
wildcard * ? []
Examples
delete music files .mp3 >10
rm musicfiles-1?.mp3
?- only one character
rm music file-?.mp3
* one or more
rm music-file-*
ls
rm txtfile-[1234]
rm file-moves-[Aa]
PIPES
pipes || are used to direct the output from one command to another
GREP
finding the matching patern
cat fruits | grep Orange
onlu
cat vegetables |grep carrot
cat vegetables |grep carrot | sort
uniq : unique no and count
cat Numbers | uniq -c
cat fruits | grep ap | sort
Alias in shell
shortcut to your own command
To list already seted alias -> alias
uptime
alias u='uptime'
u
alias doc = 'libreoffice -writer'
doc
Linux environment variables:
=> Storing a value in a location filename, text,a num, other type of data;
=> Application setting to different application
Private to currently running shell
'MYVAR = private; OURVAR = shared; printenv'
shell executes the printenv it exports as OURVAR but not as MYVAR
print env passed to child variables
To see shell variables :
set | less
HISTFILE
To print environment variables
printenv
user =cam
MYTESTVAR='This my ada'
Set | grep MYTESTVAR
>'This my ada'
exist only shell session
printenv | grep MYTESTVAR
>no data
echo $MYTESTVAR"
shell to environment var
export $MYTESTVAR"
printenv | grep MYTESTVAR
echo $MYTESTVAR"
Demoting the env var
export -n MYTESTVAR
printenv | grep MYTESTVAR
>no data
MYDIR='/home/Musicc'
echo $MYDIR
ls $MYDIR
setting the shell variables
vi ~/.bash_profile
setting the env variables
vi /etc/profile

No comments:
Post a Comment