Difference between revisions of "Bash"

From rbachwiki
Jump to navigation Jump to search
(Created page with "==Bash Scripting == <pre> Brace Expansion {}, helps with repeated commands touch {apple, banana, chery} // would create three filenames touch filename_{01..100} // will creat...")
 
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Bash Scripting ==
==[[Scripts used on Servers]]==
<pre>
==[[Useful bash commands]]==
Brace Expansion {}, helps with repeated commands
==[[Tmux]]==


touch {apple, banana, chery} // would create three filenames
== Useful Command Line Utilities ==
touch filename_{01..100} // will create 100 filenames
* [[RMLINT | RMLINT - Duplicate Finding cmd Tool]]
echo {A..Z} // prints A - Z
* [[RCLONE | Rclone syncs your files to cloud storage ]]
echo {1..10..3} // prints 1 - 10 step 3
* [[NCDU | Ncdu Ncdu is a disk usage analyzer]]
touch {apple,banana,cherry}_{01..100}{w..d}
* [[BTOP]]
* [[NTFY]]


Std Output
==[[Image Scripts]]==
cp -v * /folder 1> success.txt 2> error.txt
==[[Script Course]]==
 
==[[Centos OS | More Scripting]]==
Grep with awk
==[[Sample Scripts]]==
grep -i searchTerm filename.txt | awk {'print $12'} // will output the 12th thing on a line space delimited and only return that value
==[[File Commands]]==
 
===[[Ubuntu File System Commands]]===
Variables
* find, copy, replace, rename
Bash file
==[[AWK Command]]==
#!/bin/bash
==[[Text File Commands]]==
a=hello
* find and replace text in bulk
b="Good Morinng"
==[[BSD MAILX]]==
c=16
==[[Shell Scripting]]==
echo "$b I have $c apples."
 
output [Good Morning I have 16 Apples]
 
Get Info from users
Bash file
#!/bin/bash
echo "Enter your name"
read name
echo "What is your password"
read pass
read -p "what is your fav animal " animal
echo name: $name, pass: $pass, animal: $animal // this is an inline prompt
</pre>
----
[[#Bash Scripting|Back To Top]]-[[Main_Page| Home]]

Latest revision as of 13:22, 15 June 2023