- Use version control tools
- Manipulate file content programmatically
- Run commands on many systems simultaneously
- Install Linux Distribution
-
Following some common git commands:
git config --global user.name Ivan Grozni git config --global user.email something.gmail.com git config --list git init --bare /dir/bashscripts git status git add -A git commit -a -m "Initial Commit" git push origin master git status git checkout -b latest git branch git add delme git commit -a -m 'add new file' git checkout master git merge test git branch -d test git pull origin git log git show git diff master latest git log -S "<String to search for>" -> Shows what commit changed that line.
git clone ssh://[email protected]/tmp/test ./opala/
-> Clone repo from remote machine using ssh.- Had to set
git config receive.denyCurrentBranch ignore
from the repo side and change group and user owner != root.
- Had to set
-
Use the following command to do it:
sed, uniq, grep, tr, cut
cut --complement -d " " -f2,3 original > new
-> Delete 2nd and 3 column from file.cat file | sort | uniq -d
-> Show only duplicate lines.uniq -u
-> Shows only unique lines.awk -F: '$3 > 100'
-> Show all lines which have number greater than 100 into the 3th column.sort -t: -k 3 -n -r
-> Sort by the 3th column separated by ":" by numerical order in descending fashion. - More on sort: https://www.educba.com/sort-command-in-unix/Check them into the LFCS repo.
-
If you are managing multiple Linux servers, and you want to run multiple commands on all the Linux servers in parallel fear not. To achieve, this you can use the pssh (parallel ssh) program, a command line utility for executing ssh in parallel on a number of hosts.
-
How to install it:
yum install pssh
-
How to use it:
-
Create a file with random name pssh-hosts containig the IPs of the host you want to connect to with the following syntax:
# cat pssh-hosts 192.168.0.101:22
-
Start using it:
pssh -h pssh-hosts -i -o dir_name -l root -A df -h
-h: used to specify host file
-i: used to display standard output and standard error
-o: to save standard output to a given directory
-l: to include a default username on all hosts that do not define a specific user
-A: to ask for a password and send to ssh
-
- If you are studying for LFCE you need to know this already!