Here are some LINUX HACKS :
- Paste Code: Directly paste any code/text into terminal use Ctrl + Shift + v
- Sharing Server: You can make a quick HTTP server for sharing in Python 2 using following command:
python -m SimpleHTTPServer
- Increase Speaker Volume: Increase the maximum volume of your speakers by a certain percentage (150 in this case) :
pactl set-sink-volume 0 150%
- Fortune Messages: Make your terminal output you random fortune messages. On a ubuntu system do:
sudo apt-get install fortune
and add fortune to the last line of your .bashrc if you are using Bash (default in most distros ). If you love cows then you can install cowsay pipe the output of fortune to cowsay , add following line to the end of your .bashrcfortune | cowsay
- Starwars: Want to watch StarWars in terminal ? Just type:
telnet towel.blinkenlights.nl
- Shorten Lengthy Command: Have a lengthy command and want to short it down ? Use aliases
Add all aliases to your .bashrc so that they remain permanent. Like we used sudo apt-get install to install packages we can slim it done by defining an alias in our bashrc like:
alias install = 'sudo apt-get install'
After saving the file and restarting the terminal you can do things like:
install cowsay fortune figlet
instead of typing:sudo apt-get install fortune figlet cowsay
You can do it for many commands with the syntax alias short-name=’long command’.
# Notice there is no space between long command and equal sign ( = ) Plus some commands are pre-aliased like la is an alias for ls -a. You can this out by typing la in your terminal . - Ping and traceroute together: Want to ping and traceroute/tracert at the same time. Use mtr. Install it with:
sudo apt-get install mtr
or if you aliased the command use install mtr
Usage mtr - Download files: Want to download files with a specific pattern like:
File1 at http://example.com/files/file1.zip
File2 at http://example.com/files/file2.zip
Use wget ( comes pre-installed on most distros ) as followingwget Page on example.com
Wget can be used for crawling and other awesome automated stuff. - Download accelerator: Want a stable download accelerator use axel?
Install with sudo apt-get install axel
use as followsaxel -a
- Enable Scroll lock: Scroll Lock is disabled by default in Linux Distros. Even though the Scroll Lock doesn’t serve much of a purpose in the modern day applications. But still we might need it for some purposes like toggling the back light on our illuminated keyboards. To enable scroll lock
xmodmap -e 'add mod3 = Scroll_Lock' link
- Download files using the command line : This one is pretty common. wget is used to download files using the command line via HTP, HTTPS and FTP.
wget file.link
where file.link is the link from where the file has to be downloaded. - Download YouTube videos: You can also download YouTube videos straight from the command line using a package by the name of youtube-dl. First install the package using apt-get or pip
sudo apt-get install youtube-dl
Your package is ready to be used. You can now use it to download videos
OR
sudo pip install youtube-dlyoutube-dl Youtube-link
- Change terminal look and feel: If you want to edit the way your terminal looks, or the font sizes and other features. You have two options. gsettings or dconf. In layman terms gsettings uses the command line whereas dconf uses a GUI called dconf-editor. First we need to install dconf.
sudo apt-get install dconf-tools dconf-editor
- Be a bond: You want to look like a badass hacker ? (Kind of)
Install hollywood, your terminal will split and look like you’re doing a lot of cool thingssudo apt-add-repository ppa:hollywood/ppa sudo apt-get update sudo apt-get install hollywood sudo apt-get install byobu #Used to split your terminal, very useful
Launch byobu then hollywood (just type byobu and hollywood - Current Weather: What about the knowing the current weather of any city around the world.
In your terminal, just type:curl http://wttr.in/your_city_name
and voila, weather for next 3 days displayed elegantly in your terminal. - Same command at same time: Want to run a command you ran yesterday at a point of time?
Try Ctrl-R(recursive search) and then type a subset of characters in your command and boom you accessed a recent history without pressing key many times.