TIPS &TRICKS
Record audio from your microphone via the command line
First, download the 'sox' tool suite which is extremely versatile for audio file manipulation. Use the following command on Debian systems:
# apt-get install sox libsox-fmt-all 'libsoxfmtall' package enables playback of mp3 files.
The 'sox' suite includes two tools called 'rec' and 'play'. To record audio, insert a microphone into your audio jack and type the following command:
# rec c 1 test_file.mp3
The recording session begins and whatever you speak through the microphone is recorded. Once you are done recording, press Ctrl+C.
To play the recorded file, type the following:
#play test_file.mp3
'sox' can also handle audio files of formats like wav, ogg, etc.
—Divya Lakshmanan, divya.lakshmanan27@gmail.com
Download videos using the YouTube downloader in Linux
First, install youtube-dl by following the steps given below.
If you are running an Ubuntu based Linux distribution, you can install it using the following:
sudo apt-get install youtube-dl
For any other Linux distro, you can quickly install youtube-dl on your system through the command line interface with the following command:
sudo wget https://ytdl.org/downloads/latest/youtubedl O/usr/ local/bin/youtube-dl
After fetching the file, you need to set an executable permission on the script for it to execute properly.
sudo chmod a+rx /usr/local/bin/youtube-dl
To download a video file, simply run the following command, where ‘VIDEO_URL’ is the URL of the video that you want to download.
youtubedl <VIDEO_URL>
You can also download in multiple formats. Run the commands below to discover all that can be done using this tool:
youtube-dl -h …or: man youtube-dl —Mounica Revuru, ojaswithamonica@gmail.com
Tips for day-to-day use
Given below are a few handy tips for those who use Linux daily.
Resume typing a command after a few others Sometimes, after typing a long and complex command on a Linux terminal, we realise that we have to type some other commands, and even examine their results, before we hit Enter. Instead of discarding what we have typed, or opening another terminal/GUI text editor to store it, we can just go to the end of our typed line by using Ctrl E, and press Ctrl U to clear the line. Then, we can execute the intermediate command and just press Ctrl Y. Voila! The deferred command reappears for us to modify or execute with the use of Enter. Think of it as a kind of cut-and-paste for the contents of the line preceding the cursor.
Docker emergency shutdown
As of release 1.12.1, Docker does not have a single command to stop all running containers. But here
is a hack to do that: docker stop $(docker ps -q)
You may have to use sudo before docker both times in the command. This can save you from individually stopping dozens of containers before a system shutdown.
Swing between ‘smart quotes’ and ‘straight quotes’ in LibreOffice
Those who have been hunting around for a way to quickly use both smart and straight quotes on any PC running LibreOffice or OpenOffice, here’s the way to go about it.
Turn on Smart quotes (if turned off) using Tools » AutoCorrect Options » Localized Options.
Hit Ctrl+z (or Undo) to turn back curly quotes to straight quotes following each individual insertion.
I tested this on LibreOffice, and expect equal success with OpenOffice.
—A. Datta, webmaster@aucklandwhich.org
Adding the time stamp to the History command
The History command does not output the time stamp with the log of the most recently executed commands.
To do so, run the following command in the terminal:
# HISTTIMEFORMAT=”%d/%m/%y %T “ # history
If you want to permanently append this change, add the following line to the ~/.bashrc file:
# export HISTTIMEFORMAT=”%d/%m/%y %T “ Then, from the terminal, run the following: # source ~/.bashrc
Here’s an explanation of the commands and switches: history – GNU History library
HISTIMEFORMAT – Environmental variable
%d – Day
%m – Month
%y – Year
%T – Time stamp source – In short, send the contents of the file to the shell .bashrc – Is a shell script that BASH runs whenever it is started interactively
—Rajeeb Senapati, rajeeb.koomar@gmail.com
Add a welcome message to your terminal
This tip will show you how you can easily add a welcome message to your terminal. This message will be displayed at the start, whenever you open your terminal.
Here are the steps to follow:
1. You need to install figlet. So open the terminal and type
the following command:
sudo aptget install figlet
Then press Enter.
2. Open .bashrc in the Vim editor and press ‘’’ to get into
Insert mode.
vi .bashrc 3. Enter the following command in .bashrc: figlet c your_message
Press the Esc button; then press colon x and Enter.
4. Now, when you open your terminal, you can see your welcome message.
Here is another tip that I want to share.
Remove Amazon results from Dash in Ubuntu
Ubuntu added Amazon search results into the Unity Dash a few releases ago. While many people complained that their privacy was at risk since every search was being sent to Amazon’s servers, I personally just found the Amazon results unnecessary.
To remove the Amazon search results from the Dash, run the following command:
sudo apt-get autoremove unity-lens-shopping
…and restart. This will get rid of the Dash lens that is responsible for those results.
Alternatively, you can also go into the System Settings –> Security & Privacy, and disable Online Search Results. Do note that this toggle will affect not just the Amazon search results, but also any other Dash lenses that require the Internet to function. —Harish Tiwari, harishtiwary46@gmail.com