alias py2=python2.7
alias py3=python3
alias pyenv="python3 -m venv"
alias dk=docker
alias here="nohup nautilus -w . > /dev/null &"
alias cls=clear
alias another="gnome-terminal & disown"
function port() {
sudo lsof -i:$1
}
port 80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
firefox 23363 leon 95u IPv4 ... 0t0 TCP ...
leon@xarp:~$ ports
curltime website.com
Format file is necessary and included in the repository. Add in the home directory. Credits
ncsv <port>
ncsv 8002
This is though for opening GUI applications without needing to have have another terminal on the background, such as pycharm
or gedit
.
silent gedit file.txt test.py
silent pycharm .
The function:
- Starts the command in background and routes the output to
/dev/null
- It is not possible to autocomplete commands after the
silent
keyword, so type it later if so. - Supports any amount of arguments (
$@
)
This is meant for navigating repeatedly around directories with ease.
setloc
will set a checkpoint at the current directorygoback
will take us from anywhere to the checkpointandforth
will take us back from where we issued thegoback
commandclearloc
it will clear the locationshowloc
will display the checkpoint (setloc) and secondary location (goback/andforth) if any
cd /opt/program
leon@XARP:/opt/program$ setloc
cd ~
leon@XARP:~$ goback
leon@XARP:~$ showloc
Checkpoint location: /tmp
Current location: /tmp
Coming from /home/leon
leon@XARP:/opt/program$ andforth
leon@XARP:~$ clearloc
This is an alias for the command bc
for simple and quick use.
Do NOT add spaces.
leon@xarp:~$ calc 2+2
4
Simply reloads .bashrc
file.
Simply wipes the contents of a file. Asks for confirmation. ALso checks for file existence.
leon@xarp:/tmp$ cat a
aaaaaaaa
leon@xarp:/tmp$ empty a
...
leon@xarp:/tmp$ cat a
leon@xarp:/tmp$ empty a
Are you sure you want to clear this file contents? [y/N] n
Cancelled.
leon@xarp:/tmp$ empty a b c
This operation will affect more than one file. Proceed? [y/N] y
leon@xarp:/tmp$ empty
No filename specified
leon@xarp:/tmp$ rm a
leon@xarp:/tmp$ empty a
Are you sure you want to clear this file contents? [y/N] y
File 'a' does not exist
A function for modularizing decisions in scripts.
yes_or_no "Are you sure you want to clear this file contents?"
if [ $? -eq 1 ]; then
echo "yes"
elif [ $? -eq 0]; then
echo "no"
else
echo "Not valid input"
fi
Sets the title of a shell terminal. Does not work for zsh Credits
# Spaces allowed, sets the title of the bash terminal
set-title my new tab title
# Returns the title to the original
set-title
Displays a wait custom message. It will wait as many seconds as specified in the first argument and display a message accoding with the second argument.
The function counts down to zero from the amount of seconds specified. Instead of generating a new line, the command will update its line.
wait_msg 5 "Skipping this part"
Skipping this part [5 s]
An alias for ls
which displays the contents sorted by most recent modification and the reversed equivalent.
$ touch a
$ touch b
$ ltr
a
b
$ lt
b
a