How to print the RAM value as a number with Linux. This could be very useful in a script.
How to print the amount of RAM in your machine as a whole number.
How to print the amount of RAM in your machine as a whole number.
The gunzip utility can uncompress logfiles that are gzipped in archives, but this is not needed. To read a logfile that is gzipped, you can also use this command to print the contents to a terminal and not bother uncompressing the file. This allows reading log files in /var/log without needing root access. This is … Read more
This is a very interesting bash trick I found using ls. This runs the ls command with random parameters. This is not very useful, but interesting nonetheless. 4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | tr -dc ‘hula’ | head –bytes 1`4.4 Tue Mar 03 jason@Yog-Sothoth 0: $ ls -`cat /dev/urandom | … Read more
Reading ID3 data from an MP3 file on Linux is very easy with the ffmpeg suite. The ffprobe command can do this very easily. This example will return the title and artist of the MP3 file. 4.4 Mon Mar 02 jason@Yog-Sothoth 0: $ ffprobe -loglevel quiet -show_entries format_tags=artist,title 02\ Snake\ Hips.mp3 [FORMAT] TAG:title=Snake Hips TAG:artist=The … Read more
To get DVD playback working on Ubuntu, the libdvdcss library is required. This is easily installed and necessary to decode a DVD properly for playback. Install this package to prepare for installation. This also allows automated updates to the library. 4.4 Sat Feb 29 jason@Yog-Sothoth 1: $ sudo apt install libdvd-pkg4.4 Sat Feb 29 jason@Yog-Sothoth … Read more
The Linux find command is very useful for finding certain files. I will show how to search a folder and return a listing of files. This example below shows how to list all webm and gif files in the directory and all subdirectories. 4.4 Fri Feb 21 jason@Yog-Sothoth 0: $ find -regex ‘.*\.\(gif\|webm\)’ -print ./1397195397532.gif … Read more
The settings used by the file chooser in MATE or Gnome can be changed easily with the command line. The gsettings utility makes this easy. This example will alter the Firefox file chooser, it will have directories listed first, in descending order, sorted by date modified. gsettings set org.gtk.Settings.FileChooser sort-column ‘modified’ gsettings set org.gtk.Settings.FileChooser sort-order … Read more
List all symbolic links in a folder is very easy, this is how to find just the symlinks and not bother with any other files. This example shows how to use the find command to do this. 4.4 Tue Feb 04 jason@Yog-Sothoth 0: $ find . -type l ./boom ./chocolate-strife-setup ./LS ./heretic ./doom ./cowthink ./chocolate-doom-setup … Read more
Renaming folders is very easy. I have a folder with subdirectories named from 1 to 9. And I wish to rename them folder1 to folder9. This can be easily done with bash. This example will take care of this problem easily. 4.4 Fri Jan 31 jason@Yog-Sothoth 0: $ for i in $(seq 9);do mv $i … Read more
Blocking unwanted websites with iptables can be done. This is not done via an Internet Protocol address, as this does not work. But matching strings does work. I have found out a way to do this. This sample below shows a few rules to block a website, if you try and load it, it will … Read more
The Bandcamp website hosts a lot of music, and it is very easy to download music from the website easily on Linux. Firstly, install the Python pip3 addon. 4.4 Sat Jan 18 jason@Yog-Sothoth 0: $ sudo apt install python3-pip4.4 Sat Jan 18 jason@Yog-Sothoth 0: $ sudo apt install python3-pip Then, install the Python Bandcamp script. … Read more
The snap system allows the installation of apps into containers in your Linux system. This is very easy to use and allows easy use of a needed app. It is very easy to list which apps are installed this way. Use the snap list command to list all installed snap apps. 4.4 Wed Jan 15 … Read more
This command will only list the mounted removable drives on your Linux system. The ones under /dev/sd*. This is very easy to use. 4.4 Mon Jan 13 jason@Yog-Sothoth 0: $ cat /etc/mtab | grep /dev/s[a-f]/* /dev/sda2 /media/jason/Seagate\040Expansion\040Drive fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0 /dev/sdb4 /media/jason/My\040Stuff fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 04.4 Mon Jan 13 jason@Yog-Sothoth 0: $ cat /etc/mtab … Read more
It is easy to get comprehensive information about a user on Linux by using the command line. I will show you how to see password expiry information and other details. This example shows the use of the chage command to retrieve password expiry information. 4.4 Mon Jan 13 jason@Yog-Sothoth 0: $ sudo chage -l jason … Read more
Back up your home directory with this simple script. This will concatenate all of your files into one tar archive, then compress it into a gzipped file. Firstly, install the required applications. ┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ sudo apt install pv pigz┌──(john㉿DESKTOP-PF01IEE)-[~/Documents] └─$ sudo apt install pv pigz This is the backup script I am using. This will … Read more
The video hosting site Vimeo works the same as Youtube, it has separate files for video and audio that are put together to play an online video. This can be downloaded easily with a script. The youtube-dl script can download only the audio from a Youtube video, and it can do it for Vimeo as … Read more
Thumbnailing for the DirectDraw Surface file format is not supported in Linux with the Caja file manager, but this is easy to fix. The /usr/share/thumbnailers/ directory contains all of the thumbnailer files that automatically create thumbnails in the file manager for Caja. Just create a file named dds.thumbnailer and put this in it. 2 3 … Read more
This is a nice example in C. This will append text to a file whenever it is run. This is the proper way to do this in this programming language. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <stdlib.h> #include <stdio.h> int main(void) { FILE *f; char … Read more
There are many very useful shell tricks when using the bash shell on Linux or UNIX. Print the last used command-line arguments with a keyboard shortcut. ESC-. This will print the last used command-line arguments to the prompt. Very useful if it is a very long one-liner. Print a listing of your most-used commands and … Read more
How to unpack and use Mac OSX fonts on Linux. This is easy.