Did you forget where you were before switching branches in #git. No problem!
Just run this and you will see the last branches in your git:
git reflog
Going back to the previous branch is as easy as running:
git checkout HEAD@{1}
#gittricks#bashtricks#shelltricks
Want to know the path your Python is running from. Try:
$which python
The result will probably be:
/usr/bin/python
That's how you'll know ๐๐
#bashtricks#shelltricks#linuxiscool https://t.co/BnNxywCCZX
Need a shell calculator??
Try calc by installing:
Sudo apt-get install apcalc
๐
It works using the shell:
$ calc
; 3 * 5
15
$ calc '3 + 5'
8
#shelltricks#linux#bash#calculator https://t.co/Q41MTY6ZrQ
Linux was built for working with the shell(command line for Windows users)
So everything that can be done with the GUI can be done using the shell as well!
Want to install something
sudo apt-get install <package>
So learn to master the shell and improve your efficiency ๐๐ค
Linux was built for working with the shell(command line for Windows users)
So everything that can be done with the GUI can be done using the shell as well!
Want to install something
sudo apt-get install <package>
So learn to master the shell and improve your efficiency ๐๐ค
The &&:
'cat a && cat b'
what this does is it will run 'cat a' and only if ran successfully will ran b.
Try yourself when 'a' exists and when it doesn't and see what happens.
Any guess what || will do?
The magical eval $() will run the command inside the parenthesis and return it as text.
Try yourself!
ls -b > files.txt
echo $(cat files).
Or:
for i in $(ls -b); do mv $i $i.txt; done
This will add .txt to the end of each file in your current directory
#bash#Linux#shelltricks
The asterik(*):
Bash supports a basic form of regular expressions with file names:
* will replace anything in a file name. For example:
cat *.txt
Will print every file of the form: hello.txt, a.txt, my_file.txt, etc..
cat *ello* will print files like:
Hello.prop mello, etc..
Useful command with '&&':
git fetch - v && git rebase origin/master
Will fetch changes and only if succeeded in doing so, it will try to rebase them.
The &&:
'cat a && cat b'
what this does is it will run 'cat a' and only if ran successfully will ran b.
Try yourself when 'a' exists and when it doesn't and see what happens.
Any guess what || will do?
If you ever tried piping command into or from vi/vim you know it can be a mass. For that reason you can use 'vipe'. Which makes piping to vim easy as possible. Try yourself:
$ ls / | vipe