GraphicsMagick – A Powerful Image Processing CLI Tool for Linux

GraphicsMagick is a free open source, modern and powerful software suite for processing images. It was initially derived from ImageMagick, however, over the years, it has grown to be a fully independent project, with a number of improvements and additional features. It runs on all Unix-like operating system such as Linux, MacOS, and also runs on Windows.

It offers a useful and efficient assortment of tools as well as libraries that allow for reading, writing, and manipulating your images in more than 88 well known formats (such as GIF, JPEG, JPEG-2000, PNG, PDF, PNM, and TIFF).

It can create a composite image in grid format, from multiple images, and create images in web supported formats such as WEBP. It is also used to change image size, sharpen, color reduce, rotate or add special effects to images of various formats. Importantly, it can create a GIF animation from multiple images and much more.

How to Install GraphicsMagick on Linux Systems

On Debian and its derivative such as Ubuntu and Linux Mint, you can install it using APT-package manager as shown.

$ sudo apt-get update
$ sudo apt-get install graphicsmagick

On Arch Linux and Fedora, you can install GraphicsMagick from the default system repositories using package manager as shown.

$ sudo pacman -S graphicsmagick    [On Arch Linux]
$ sudo dnf install GraphicsMagick  [On Fedora 25+]

On other Linux distributions such as RHELCentOS and Fedora (older releases), you can compile GraphicsMagick from source code as shown.

----------- Install GraphicsMagick on RHEL and CentOS ----------- 
# yum install libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel jasper jasper-devel
# wget -c https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.28/GraphicsMagick-1.3.28.tar.xz
# xz -c GraphicsMagick-1.3.28.tar.xz | tar -xvf -
$ cd GraphicsMagick-1.3.28/
$ ./configure 
$ make
$ make install
----------- Install GraphicsMagick on Fedora ----------- 
# dnf install libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel jasper jasper-devel
# wget -c https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.28/GraphicsMagick-1.3.28.tar.xz
# xz -c GraphicsMagick-1.3.28.tar.xz | tar -xvf -
$ cd GraphicsMagick-1.3.28/
$ ./configure 
$ make
$ make install

To access GraphicsMagick functions, use gm – a powerful command-line utility, which offers several sub-commands such as display, animate, concert, montage, compare, identify, composite and many more, for accessing the actual functions.

To confirm that the GraphicsMagick package has been installed on your system, you can run the following command.

$ gm display 

Verify GraphicsMagick Installation

Verify GraphicsMagick Installation

Then run the following series of commands to verify many aspects of the installed package.

$ gm convert -list formats	#check that the expected image formats are supported
$ gm convert -list fonts	#check if fonts are available
$ gm convert -list delegates	#check if delegates (external programs) are configured as expected
$ gm convert -list colors	#check if color definitions may be loaded
$ gm convert -list resources	#check that GraphicsMagick is properly identifying the resources of your machine

Learn How to Use GraphicsMagick in Linux

Following are some basic examples of how to use gm command with these options.

1. To display or view an image from the terminal, run following command.

$ gm display girlfriend.jpeg

View Image in Linux Terminal

View Image in Linux Terminal

2. To resize an image with new width, specify a width and height will auto scale proportionally as shown.

$ gm convert -resize 300 girlfriend-1.jpeg girlfriend-1-resize-300.jpeg
$ gm display girlfriend-1-resize-300.png

Resize Image in Linux Terminal

Resize Image in Linux Terminal

You can also define a width and a height, and the command will resize the image to that dimensions without altering the proportions.

$ gm convert -resize 300x150 girlfriend-1.jpeg girlfriend-1-resize-300x150.jpeg
$ gm display girlfriend-1-resize-300.png

3. To create an animated image of multiple images in the current working directory, you can use the following command.

$ gm animate *.png	

Animate Images in Linux Terminal

Animate Images in Linux Terminal

Note: The above animated image quality is poor, because we have optimized to lower the size of image.

4. To convert an image to one format to other, for example .jpeg to .png and vise-versa.

$ gm convert girlfriend.jpeg girlfriend.png

5. Next, you can create a visual image directory of all your .png images as shown.

$ gm convert 'vid:*.jpeg' all_png.miff
$ gm display all_png.miff

Create Visual Image

Create Visual Image

6. Additionally, it is possible to create a composite image (in a grid format) from separate images as shown.

$ gm montage girlfriend.jpeg girlfriend-1.jpeg girlfriend-2.jpeg composite_image.png
$ gm display composite_image.png 

Create Grid Format Images

Create Grid Format Images

There is a lot you can do with gm command, we have just covered a few basic examples in this article. You can see see all options for gm and its sub-command, for example, convert, type:

$ gm -help
$ gm help convert

For more information, visit GraphicsMagick Homepage: http://www.graphicsmagick.org/

GraphicsMagick is a powerful and feature-rich image processing system for Linux and other Unix-like systems. If you have any questions or thoughts to share, use the feedback form below.

Source

Screenlets: An Amazing Tool to Add Desktop Gadgets/Widgets in Linux

Screenlets is an application software released under GNU GPL. The same name screenlets refers to the engine as well as widget that runs on it. It was Originally Developed by ‘Rico Pfaus‘, ‘Helder Fraga‘ and ‘Natan Yellin‘ for Unix-like Operating System. Designed specially to run on X11-based compositing windows manager like compiz.

Screenlets are small pieces of application commonly called widget. They serves as eye candy besides improving overall system experience of modern Linux-desktop. Widgets represents virtual things on desktop viz., Clock, Sticky notes, weather, Calculator, Calendar,…

Features of Screenlets

  1. Easy from End-user point as well as from Developer point of view.
  2. A wide range of screenlets/widget to choose from.
  3. Deploy Google gadgets on screenlets engine.
  4. Full compositing Support.
  5. Works with any composited X desktop as well as non-composited desktop
  6. Fully Scalable
  7. Embedded Drag & Drop
  8. Highly Customizable
  9. Automatic options saving.
  10. Themes feature supported

Screenlets version <= 0.0.14 were written in Python later on the concept of web widgets were introduced which were typically written in HTML, JavaScript and CSS.

Installing Screenlets in Linux

1. You can download and install screenlets from the repository (if available), most of the modern Linux distribution includes screenlets to be downloaded from default repository.

$ sudo apt-get install screenlets screenlets-pack-all

The above command will install screenlets application and complete pack, which includes number of widgets/gadgets in it.

During installation, in my Debian 8.0 Jessie, I’ve got the following depnedency error message….

Gtk-Message: Failed to load module "canberra-gtk-module"

To fix this, you need to install following package.

$ sudo apt-get install libcanberra-gtk-module

2. After installing Screenlets, start the application using user account only and not root.

$ screenlets

Screenlets: Preview

Screenlets: Preview

3. To add a widget to your screen double click it. You may add as many screenlets as you want. There is no limitation.

Add Widgets to Desktop

Add Widgets to Desktop

4. You can close all the running widgets at once, reset Screenlets Config, Install new theme, Restart All, Create Desktop Shortcut as well as Auto-Start at login using the options available in the left of Screenlets Manager.

Screenlets Manager

Screenlets Manager

5. You can also configure the options like Setting position of Specific Screenlets, scale it, control opacity as well as options like stick to desktop, Lock Position, Keep above/below and etc..

Configure Screenlets

Configure Screenlets

The screenlets application is quiet stable and mature project. If you are newbie to Linux, several GUI System monitor tool will help you to understand what’s going on. If you are developer you can write your own screenlets for the screenlets engine. As said above, these widgets are small and hence easy to develop.

That’s all for now. I’ll be here again with another interesting article. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feed back in the comments below. Like and share us and help us get spread.

Source

Install YouTube-DL – A Command Line Video Download Tool for Linux

youtube-dl is a Python based small command-line tool that allows to download videos from YouTube.comDailymotionGoogle VideoPhotobucketFacebookYahooMetacafeDepositfiles and few more similar sites. It written in pygtk and requires Python interpreter to run this program, it’s not platform restricted. It should run on any UnixWindows or in Mac OS X based systems.

Recently, youtube-dl added video download support for 17 new websites: brightcove.comauengine.comRingTVinstagram.comJukebox3satCSpanStatigr.amtraileraddict.comhotnewhiphop.comwat.tvtu.tvgamespot.com, tudou.comWimp.comarchive.org and break.com

youtube-dl also allows to choose specific avialable video quality format to download or let the program itself automatically download higher quality video from the site. It also has supports for user specific playlistdownloads, options to add custom or original title to the downloaded video file. proxy support and many more.

Linux Commandline YouTube Video Download

Download YouTube Videos in Linux

Install YouTube-DL in RHEL/CentOS and Fedora

The youtube-dl program can be installed by enabling epel repository under your systems. Once enabled, you can install using ‘yum‘ package manager tool as shown.

# yum install youtube-dl

Update: If you don’t wish to add any third party repository, you can still install it right away using curl or wgetcommand as shown.

# curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
# wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

Note: Your system must have curl or wget packages installed to fetch the recent version youtube-dl file. If you don’t have them, you may yum to get it.

After fetching the file, you need to set a executable permission on the script to execute properly.

chmod a+rx /usr/local/bin/youtube-dl

Install YouTube-DL in Ubuntu/Linux Mint and Debian

Ubuntu users can download and install latest youtube-dl version from the webupd8 PPA as shown.

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install youtube-dl

Update: Similarly, instead using any third party PPA, you can use curl or wget command to install latest version of youtube-dl script as shown.

$ sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

After downloading the script, set the executable permission.

$ sudo chmod a+rx /usr/local/bin/youtube-dl

Update YouTube-DL

Youtube-dl itself can be updated to the latest version using the following command.

# youtube-dl -U
Sample Output
Updating to version 2015.09.03 ...
Updated youtube-dl. Restart youtube-dl to use the new version.

How to Use YouTube-DL to Download Videos

To download a video file, simply run the following command. Where “VIDEO_URL” is the url of the video that you want to download.

# youtube-dl https://www.youtube.com/watch?v=iRYvuS9OxdA
Sample Output
[youtube] iRYvuS9OxdA: Downloading webpage
[youtube] iRYvuS9OxdA: Downloading video info webpage
[youtube] iRYvuS9OxdA: Extracting video information
[youtube] iRYvuS9OxdA: Downloading js player new-en_US-vflCeB3p5
[youtube] iRYvuS9OxdA: Downloading DASH manifest
[download] Destination: Amy Macdonald - This Is The Life-iRYvuS9OxdA.mp4
[download] 100% of 10.33MiB in 00:01

To list all available formats of video, use option “–list-formats” with the youtube-dl command.

# youtube-dl --list-formats https://www.youtube.com/watch?v=iRYvuS9OxdA
Sample Output
[youtube] vKtwZmhX0lw: Downloading webpage
[youtube] vKtwZmhX0lw: Downloading video info webpage
[youtube] vKtwZmhX0lw: Extracting video information
[youtube] vKtwZmhX0lw: Downloading DASH manifest
[youtube] vKtwZmhX0lw: Downloading DASH manifest
[info] Available formats for vKtwZmhX0lw:
format code  extension  resolution note
171          webm       audio only DASH audio  113k , vorbis@128k (44100Hz), 1.86MiB
140          m4a        audio only DASH audio  128k , m4a_dash container, aac  @128k (44100Hz), 2.14MiB
141          m4a        audio only DASH audio  255k , m4a_dash container, aac  @256k (44100Hz), 4.30MiB
278          webm       180x144    DASH video   63k , webm container, vp9, 1fps, video only, 946.76KiB
160          mp4        180x144    DASH video  112k , avc1.4d400c, 15fps, video only, 1.86MiB
242          webm       300x240    DASH video  170k , vp9, 1fps, video only, 2.50MiB
133          mp4        300x240    DASH video  247k , avc1.4d400d, 25fps, video only, 4.11MiB
243          webm       400x320    DASH video  288k , vp9, 1fps, video only, 4.07MiB
13           3gp        unknown    small 
17           3gp        176x144    small ,  mp4a.40.2, mp4v.20.3
36           3gp        320x240    small ,  mp4a.40.2, mp4v.20.3
5            flv        400x240    small 
43           webm       640x360    medium ,  vorbis, vp8.0
18           mp4        640x360    medium ,  mp4a.40.2, avc1.42001E (best)

To download a preferred file format, use the option ‘-f’ (video format code). For example, I would like to download mp4 format, So I use format code as ‘18‘ as shown below.

# youtube-dl -f 18 https://www.youtube.com/watch?v=iRYvuS9OxdA
Sample Output
[youtube] iRYvuS9OxdA: Downloading webpage
[youtube] iRYvuS9OxdA: Downloading video info webpage
[youtube] iRYvuS9OxdA: Extracting video information
[youtube] iRYvuS9OxdA: Downloading DASH manifest
[download] Amy Macdonald - This Is The Life-iRYvuS9OxdA.mp4 has already been downloaded
[download] 100% of 10.33MiB

To download a list of video files, create a file and place all the YouTube links that you wish to download.

# youtube-dl -a youtube_links.txt

Type the following command in a terminal to list all the avialable options.

# youtube-dl --help

For other distributions, youtube-dl can be downloaded from the youtube-dl download page.

Source

How to Monitor Keyboard Keystrokes Using ‘LogKeys’ in Linux

Key Logging is the process of storing keystrokes with/without the knowledge of user. Keylogging can be hardware based as well as software based. As clear from the name, a hardware based keylogger does not depends upon any software and keystroke logging is done at hardware level itself. Whereas a software based keylogger depends upon a special software for keylogging.

There are number of keylogger software applications for almost all the platforms be it WindowsMacLinux. Here we are throwing light on an application package called Logkeys.

What is Logkeys?

Logkeys is a Linux keylogger. It is more updated than any other available keylogger, Moreover logkeys don’t crash the X server, and appears to work in all the situations. Logkeys creates a log of all characters and function keys. Moreover logkeys are aware of Alt and Shift and works well with serial as well as USB keyboards.

There are a lot of keyloggers available for Windows but this is not the case with Linux. Logkeys is not better than any other keylogger application for Linux but certainly it is more updated than other.

Installation of Logkeys in Linux

If you’ve ever installed a Linux tarball packages from source, then you can easily install logkeys package. If you haven’t ever installed a package in Linux from source yet, then you need to install some missing packages like C++ compilers and gcc libraries before proceeding for installation from source.

$ sudo apt-get install build-essential		[on Debian based systems]
# yum install gcc make gcc-c++			[on RedHat based systems]

Let’s proceed for the installation, first grab the latest logkeys source package using wget command or use git to clone it as shown:

-------------------- Download Source Package -------------------- 
$ wget https://github.com/kernc/logkeys/archive/master.zip
$ unzip master.zip  
$ cd logkeys-master/   

OR

-------------------- Use Git to Clone -------------------- 
$ git clone https://github.com/kernc/logkeys.git
$ cd logkeys

Now build and install logkeys.

$ ./autogen.sh
$ cd build         
$ ../configure
$ make
$ sudo make install 

Now run the locale-gen.

$ sudo locale-­gen
Sample Output
Generating locales (this might take a while)...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  en_CA.UTF-8... done
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  en_IE.UTF-8... done
  en_IN.UTF-8... done
  en_NG.UTF-8... done
  en_NZ.UTF-8... done
  en_PH.UTF-8... done
  en_SG.UTF-8... done
  en_US.UTF-8... done
  en_ZA.UTF-8... done
  en_ZM.UTF-8... done
  en_ZW.UTF-8... done
Generation complete.

Usages of logkeys

  1. logkeys ­s : Start logging keypress.
  2. logkeys ­k : Kill logkeys process.

For detailed information of logkeys usages option, you can always refer to.

# logkeys –help

or

# man logkeys

Starting the application logkeys using the following command.

$ sudo logkeys ­-s

Now running a lot of commands.

# ls
# pwd
# ss
# ifconfig

Terminate the process logkeys.

# logkeys -k

Check the log file which by default is ‘/var/log/logkeys.log‘.

# nano /var/log/logkeys.log

Keyboard Track in Linux

LogKey Logs

To uninstall logkeys, remove all scripts and manuals:

$ sudo make uninstall # in the same build dir

Future Developments Planned

  1. To add support for sending logs via email
  2. To add support for logging clipboard content
  3. To add support for mouse event/mouse click event

References

https://github.com/kernc/logkeys

All the information provided is strictly for educational purpose, Tweaking this article by any means or using the above information to log others users machine is against law and punishable. That’s all for now.

Source

Install Scalpel (A Filesystem Recovery Tool) to Recover Deleted Files/Folders in Linux

Many a times it happens that we accidentally or by mistakenly press ‘shift + delete‘ to files. By human nature you have an habit of using ‘shift + Del‘ instead of using only ‘Delete‘ option. I actually had this incident few days back. I was working on a project and saved my work file in a directory. There were many unwanted files in that directory and needs to be deleted permanently. So I started deleting them one by one. While deleting those files, I accidentally pressed ‘shift delete‘ to one of my important file. The file got deleted permanently from my directory. I was wondering how to recover deleted files and had no clue what to do. I almost spent much time restoring the file but no luck.

Recover files in Linux

Scalpel Recovery Tool For Linux

Knowing a bit of technical knowledge I knew about how file system and HDD works. When you delete a file accidentally, the content of the file does not get deleted from your computer. It is just removed from the database folder and you cannot see the file into the directory, but it still remains in somewhere in your hard drive. Basically the system has a list pointer to blocks on the storage device still has the data. The data is not deleted from the block storage device unless and until you overwrite with a new file. At this point of view I released that my deleted file may still remain somewhere in an unindexed area of the Hard disk. However it is recommended to immediately unmount a device as soon as you realize that you have deleted any important file. Unmount helps you to prevent the blocked files from overwritten with new file.

In this scenario I didn’t want to over write that data, hence I preferred to search in the hard drive without mounting it.

Normally in Windows we get tons of 3rd party tools to recovery lost data, but in Linux only few. However I use Ubuntu as an operating system and it is very difficult to find a tool that recovers lost file. During my research I got to know about ‘Scalpel‘ a tool that runs through entire hard drive and recovers a lost file. I installed and successfully recovered my lost file with the help of Scalpel tool. It’s really amazing tool I must say.

This can also happen with you as well. So I thought of sharing my experience with you. In this article I will show you how to recover deleted files with the help of scalpel tool. So here we go.

What is Scalpel Tool?

Scalpel is an open source file system recovery for Linux and Mac operation systems. The tool visits the block database storage and identifies the deleted files from it and recover them instantly. Apart from file recovery it is also useful for digital forensics investigation.

How to Install Scalpel in Debian/Ubuntu and Linux Mint

To Install Scalpel, open terminal by doing “CTrl+Alt+T” from desktop and run the following command.

$ sudo apt-get install scalpel
Sample Output
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  scalpel
0 upgraded, 1 newly installed, 0 to remove and 390 not upgraded.
Need to get 0 B/33.9 kB of archives.
After this operation, 118 kB of additional disk space will be used.
Selecting previously unselected package scalpel.
(Reading database ... 151082 files and directories currently installed.)
Unpacking scalpel (from .../scalpel_1.60-1build1_i386.deb) ...
Processing triggers for man-db ...
Setting up scalpel (1.60-1build1) ...
tecmint@tecmint-Latitude-D630:~$

Installing Scalpel in RHEL/CentOS and Fedora

To install scalpel recovery tool, you need to first enable epel repository. Once it enabled, you can do ‘yum‘ to install it as shown.

# yum install scalpel
Sample Output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.01link.hk
 * epel: mirror.nus.edu.sg
 * epel-source: mirror.nus.edu.sg
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package scalpel.i686 0:2.0-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================
 Package		Arch		Version			Repository		Size
==========================================================================================================================================================
Installing:
 scalpel                i686            2.0-1.el6               epel                    50 k

Transaction Summary
==========================================================================================================================================================
Install       1 Package(s)

Total download size: 50 k
Installed size: 108 k
Is this ok [y/N]: y
Downloading Packages:
scalpel-2.0-1.el6.i686.rpm                                                           |  50 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : scalpel-2.0-1.el6.i686							1/1 
  Verifying  : scalpel-2.0-1.el6.i686                                                   1/1 

Installed:
  scalpel.i686 0:2.0-1.el6                                                                                                                                

Complete!

Once scalpel is installed you need to do text editing. By default scalpel utility has its own configuration file in ‘/etc‘ directory and full path is “/etc/scalpel/scalpel.conf” or “/etc/scalpel.conf“. You can notice that everything is commented out (#). So before running scalpel you need to uncomment the file format that you need to recover. However uncomment the entire file is time consuming and will generate a huge false results.

Let say for example I want to recover only ‘.jpg‘ files, so simply uncomment ‘.jpg‘ file section for the scalpel configuration file.

# GIF and JPG files (very common)
        gif     y       5000000         \x47\x49\x46\x38\x37\x61        \x00\x3b
        gif     y       5000000         \x47\x49\x46\x38\x39\x61        \x00\x3b
        jpg     y       200000000       \xff\xd8\xff\xe0\x00\x10        \xff\xd9

Go to terminal and type following syntax. The ‘/dev/sda1‘ is a location of a device from where the file is already deleted.

$ sudo scalpel /dev/sda1-o output

The ‘-o‘ switch indicates a output directory, where you want to restore your deleted files. Make sure that this directory is empty before running any command otherwise it will give you an error. The output of the above command is.

Scalpel version 1.60
Written by Golden G. Richard III, based on Foremost 0.69.

Opening target "/dev/sda1"

Image file pass 1/2.
/dev/sda1:   6.1% |***** 		|    6.6 GB    39:16 ETA

As you see, the scalpel is now performing its process and it will take time to recovery your deleted file depending upon the disk space that you are trying to scan and the speed of the machine.

I would recommend you all to have a habit of using only delete instead of “Shift + Delete“. Because as said prevention is always better than cure.

Source

Woof – Easily Exchange Files Over a Local Network in Linux

Woof (short for Web Offer One File) is a simple application for sharing files between hosts on a small local network. It consists of a tiny HTTP server that can serve a specified file for a given number of times (default is once) and then terminates.

To use woof, simply invoke it on a single file, and the recipient can access your shared file via a web browser or using a command-line web-client such as cURLHTTPiewget or kurly (a curl alternative) from the terminal.

One advantage of woof over other file sharing tools is that it shares files between a different operating system, or different devices (computers, smartphones, tablets etc.), provided the recipient has a web browser installed.

In this article, we will show how to install woof in Linux and use it to share files on a local network.

How to Install and Use Woof in Linux

On Debian and Ubuntu, you can easily install ‘woof‘ package from the distribution’s default repositories using aptor apt-get package manager as shown.

$ sudo apt install woof
OR
$ sudo apt-get install woof

On other Linux distributions, you can download the woof script using wget command and move it to a /usr/bindirectory as shown.

$ wget http://www.home.unix-ag.org/simon/woof
$ sudo cp woof /usr/bin/

To share a file, provide it as an argument as shown.

$ woof ./bin/bashscripts/getpubip.sh 

Then woof will generate a URL (http://192.168.43.31:8080/ in this case) which your partner can use to access the file.

Share File with Woof

Share File with Woof

Send the URL to the recipient. Once the recipient accesses the file, woof will shutdown (see the following screenshot).

Access File Shared via Woof

Access File Shared via Woof

Note: In the above example, we have used wget command line downloader to obtain the shared file, and it automatically assigns the downloaded file a different name (for instance index.html).

To specify a custom name, use the -O option as shown.

$ wget -O  custom_name http://192.168.43.31:8080

Alternatively, you can also access the shared file from the web browser as shown (click Save File to download it).

Download Shared File from Web Browser

Download Shared File from Web Browser

By default, woof shares the file once, and after the recipient downloads it, woof terminates. You can set the number of time woof shares a file before it shuts down, using the -c option.

The following command will terminate woof after three downloads.

$ woof -c 3 ./bin/bashscripts/getpubip.sh

To share a directory, you can create a tarball and compress it by using (-z for gzip compression, or -j for bzip2 compression, or -Z for ZIP compression). For example:

$ woof -c 2 -z ./bin/

Check out the download file name, it should be a Gzip archive as shown in the following screenshot.

Download Compressed Tar Archive File

Download Compressed Tar Archive File

In addition, you can use the -U flag to tell woof to provide an upload form, allowing file uploads. The file will be uploaded to the current directory where woof was launched from:

$ woof -U

Then your partner can use the generated URL to access the upload form from a browser as shown.

Woof File Upload Form

Woof File Upload Form

After browsing and selecting the file, click the Upload button to upload files.

Woof File Upload Complete

Woof File Upload Complete

You can verify, that the file should be uploaded to the same directory where woof was invoked.

Verify File Uploads

Verify File Uploads

You can see more usage options by running:

$ man woof 
OR
$ woof -h

Woof is a small, simple and easy-to-use HTTP server for sharing files on a local areas network. In this article, we showed how to install and use woof in Linux. Use the feedback form below to share your thoughts about this tool or ask questions.

Source

5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit

This tutorial describes how to find out whether your Linux system’s OS is 32-bit or 64-bit. This will be helpful if you wanted to download or install an application in your Linux system. As we all know, we can’t install 64-bitapplications into a 32-bit OS type. That’s why knowing your Linux system’s OS type is important.

Check Linux System is 32-bit or 64-bit

Check Linux System is 32-bit or 64-bit

Here are the five easy and simple methods to verify your Linux system’s OS type. It doesn’t matter whether you’re using a GUI or CLI type systems, the following commands will work on almost all Linux operating systems such as RHEL, CentOS, Fedora, Scientific Linux, Debian, Ubuntu, Linux Mint, openSUSE etc.

1. uname Command

uname -a command will display your Linux system’s OS type. This is the universal command and it will work on almost all Linux/Unix operating systems.

To find out the system’s OS type, run:

$ uname -a

Linux tecmint.com 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2. dpkg Command

dpkg command will also display whether your Debian/Ubuntu operating system is 32-bit or 64-bit. This command will work only on Debian and Ubuntu based distributions and it’s derivatives.

Open your Terminal, and run:

$ dpkg --print-architecture 

If your OS is 64-bit, you’ll get the following output:

amd64

If your OS is 32-bit, then the output will be:

i386

3. getconf Command

getconf command will also display the system configuration variables. Now, let me show you how to find out the Linux system arch using getconf command.

$ getconf LONG_BIT

64

For more details refer the man pages.

$ man getconf

4. arch Command

arch command will display your OS type. This command is similar to uname -m command. If its output is x86_64 then it’s 64-bit OS. If the output is i686 or i386, then it’s 32-bit OS.

$ arch

x86_64

5. file Command

file command with with a special argument /sbin/init will display the OS type.

$ file /sbin/init

/sbin/init: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=7a4c688d009fc1f06ffc692f5f42ab09e68582b2, stripped

Conclusion

You now know the ways to find out your Linux operating system’s type. Of course, there are few other ways to find out the OS type, but these are the often and pragmatic methods so far. If you know any other commands or methods to display the OS type, feel free to let us know in the comments section below.

Source

How to Clear RAM Memory Cache, Buffer and Swap Space on Linux

Like any other operating system, GNU/Linux has implemented a memory management efficiently and even more than that. But if any process is eating away your memory and you want to clear it, Linux provides a way to flush or clear ram cache.

Clear RAM Cache and Swap in Linux

How to Clear Cache in Linux?

Every Linux System has three options to clear cache without interrupting any processes or services.

1. Clear PageCache only.

# sync; echo 1 > /proc/sys/vm/drop_caches

2. Clear dentries and inodes.

# sync; echo 2 > /proc/sys/vm/drop_caches

3. Clear PageCache, dentries and inodes.

# sync; echo 3 > /proc/sys/vm/drop_caches 

Explanation of above command.

sync will flush the file system buffer. Command Separated by “;” run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to drop_cache will clean cache without killing any application/service, command echo is doing the job of writing to file.

If you have to clear the disk cache, the first command is safest in enterprise and production as “...echo 1 > ….” will clear the PageCache only. It is not recommended to use third option above “...echo 3 >” in production until you know what you are doing, as it will clear PageCachedentries and inodes.

Is it a good idea to free Buffer and Cache in Linux that might be used by Linux Kernel?

When you are applying various settings and want to check, if it is actually implemented specially on I/O-extensive benchmark, then you may need to clear buffer cache. You can drop cache as explained above without rebooting the System i.e., no downtime required.

Linux is designed in such a way that it looks into disk cache before looking onto the disk. If it finds the resource in the cache, then the request doesn’t reach the disk. If we clean the cache, the disk cache will be less useful as the OS will look for the resource on the disk.

Moreover it will also slow the system for a few seconds while the cache is cleaned and every resource required by OS is loaded again in the disk-cache.

Now we will be creating a shell script to auto clear RAM cache daily at 2am via a cron scheduler task. Create a shell script clearcache.sh and add the following lines.

#!/bin/bash
# Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
echo "echo 3 > /proc/sys/vm/drop_caches"

Set execute permission on the clearcache.sh file.

# chmod 755 clearcache.sh

Now you may call the script whenever you required to clear ram cache.

Now set a cron to clear RAM cache everyday at 2am. Open crontab for editing.

# crontab -e

Append the below line, save and exit to run it at 2am daily.

0  2  *  *  *  /path/to/clearcache.sh

For more details on how to cron a job you may like to check our article on 11 Cron Scheduling Jobs.

Is it good idea to auto clear RAM cache on production server?

No! it is not. Think of a situation when you have scheduled the script to clear ram cache everyday at 2am. Everyday at 2am the script is executed and it flushes your RAM cache. One day for whatsoever reason, may be more than expected users are online on your website and seeking resource from your server.

At the same time scheduled script run and clears everything in cache. Now all the user are fetching data from disk. It will result in server crash and corrupt the database. So clear ram-cache only when required,and known your foot steps, else you are a Cargo Cult System Administrator.

How to Clear Swap Space in Linux?

If you want to clear Swap space, you may like to run the below command.

# swapoff -a && swapon -a

Also you may add above command to a cron script above, after understanding all the associated risk.

Now we will be combining both above commands into one single command to make a proper script to clear RAM Cache and Swap Space.

# echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'

OR

$ su -c "echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'" root

After testing both above command, we will run command “free -h” before and after running the script and will check cache.

Clear RAM Cache and Swap Space

That’s all for now, if you liked the article, don’t forget to provide us with your valuable feedback in the comments to let us know, what you think is it a good idea to clear ram cache and buffer in production and Enterprise?

Source

whowatch – Monitor Linux Users and Processes in Real Time

whowatch is a simple, easy-to-use interactive who-like command line program for monitoring processes and users on a Linux system. It shows who is logged on to your system and what they are doing, in a similar fashion as the w command in real-time.

It shows total number of users on the system and number of users per connection type (local, telnet, ssh and others). whowatch also shows system uptime and displays information such as user’s login name, tty, host, processes as well as the type of the connection.

In addition, you can select a particular user and view their processes tree. In the process tree mode, you can send the SIGINT and SIGKILL signals to selected process in a fun way.

In this brief article, we will explain how to install and use whowatch on Linux systems to monitor users and processes in real time in a machine.

How to Install whowatch in Linux

The program whowatch can be easily installed from the default repositories using package manager on your Linux distribution as shown.

$ sudo apt install whowatch  [On Ubuntu/Debian]
$ sudo yum install whowatch  [On CentOs/RHEL]
$ sudo dng install whowatch  [On Fedora 22+]

Once installed, you can simply type the whowatch in the command line, you will see the following screen.

$ whowatch

Monitor Logged in Users

Monitor Logged in Users

You can view a particular user’s details, simply highlight the user (use the Up and Down arrows to navigate). Then press d key to list the user information as shown in this screenshot.

Check User Information in Linux

Check User Information in Linux

To view a users process tree, press Enter after highlighting that particular user.

Monitor User Process

Monitor User Process

To view all Linux user processes tree, press t.

Monitor Linux User Processes

Monitor Linux User Processes

You can also view Linux system information by pressing s key.

Check Linux System Information

Check Linux System Information

For more information, see the whowatch man page as shown.

$ man whowatch

You will also find these related articles useful:

  1. How to Monitor Linux Commands Executed by System Users in Real-time
  2. How to Monitor User Activity with psacct or acct Tools

That’s all! whowatch is a simple, easy-to-use interactive command line utility for monitoring processes and users on a Linux system. In this brief guide, we have explained how to install and use whowatch. Use the feedback form below to ask any questions or share your thoughts about this utility.

Source

Rainbow Stream – An Advanced Command-line Twitter Client for Linux

For all those people who like to use Twitter in console/terminal rather than Graphical User Interface can now access their twitter account right from the Linux Console. Yes you heard it right. You can now access your Twitter account using a Linux Command-line Twitter Client called Rainbow Stream.

Command Line Twitter Client for Linux

Command Line Twitter Client for Linux

What is Rainbow Stream

Rainbow Stream is a free and open source Twitter-client for Linux command-line, released under MIT License. It is capable of showing Realtime tweetstream, compose a tweet, search, favorite,…..etc. Rainbow Stream gives a real-fun right into your Linux terminal. It is also capable of showing twitter images directly on terminal.

It is written in Python and built on top of Twitter API and Python Twitter Tool. To run this application in your console you must have installed python and pip version 2.7.x or 3.x.

Features of RainbowStream

  1. Free and open source Twitter-client for Linux command-line.
  2. Capable of rendering twitter image in Terminal.
  3. Support Proxy.
  4. Interactive Mode supported.
  5. Theme Customization well implemented.
  6. Capable of showing Real-time Twitter stream.
  7. You can tweet, search, favorite tweets right from your terminal.

Installation of Rainbow Stream Twitter Client in Linux

In most of the today’s Linux distribution, python should already be installed on your system. You may check the version of Python installed as:

$ python --version

Check Python Version

Check Python Version

 

Next, install python-pip package using following commands as per your Linux distributions.

# apt-get install python-pip 	[on Debian alike systems]
# yum install python-pip 	[on CentOS alike systems]

Note: Use ‘dnf‘ in place of yum, if you are on Fedora 22.

Check version of installed pip.

$ pip --version

pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

Now its time to install rainbow stream twitter client.

# pip install rainbowstream 	[For Python 2.7.x version]
# pip3 install rainbowstream	[For Python 3.x version]

After successful installation you should get the below message in your terminal.

Install Rainbow Stream Twitter Client

Rainbow Steam Installation Successful

You may like to get help on rainbowstream.

$ rainbowstream -h 
OR
$ rainbowstream --h 

Rainbow Stream Help

Rainbow Stream Help

Rainbow Stream Twitter Client Usage

1. First you need to connect and authorize application on twitter site using your twitter account.

Note: You must have a twitter account, if you don’t create one.

2. Now type 'rainbowstream' in your Linux terminal, as user.

$ rainbowstream

It will open a tab in your default HTTP web browser, login and you will get a pin. If you have already logged into your account the page should be showing PIN. If you have configured more than one Twitter account in your HTTP web browser, consider trying logging out of other account and login to the account you want to connect.

Authorize Rainbow Stream

Authorize Rainbow Stream

Grant Access to Rainbow Stream

Grant Access to Rainbow Stream

3. Copy the PIN from HTTP web Browser into your terminal and hit return key.

Twitter PIN

Twitter PIN

It will take a few seconds and you should get your twitter_user_name in your Linux prompt.

Twitter Username

Twitter Username

Notice your Twitter stream, you should see tweets by those whom you follow.

Twitter Tweets 1

Twitter Tweets 1

Twitter Tweets 2

Twitter Tweets 2

4. To display tweet’s images directly in your Terminal, you can do:

twitter: rainbowstream -iot

Display Twitter Images

Display Twitter Images

Twitter Image

Twitter Image

5. To display current twitter Trend.

twitter: trend

Show Twitter Trend

Show Twitter Trend

6. To see current twitter trend specifically country-wise, for example India (IN).

twitter: trend IN

See Country Wise Twitter Trends

See Country Wise Twitter Trends

Note: Here IN is for India. If you want to see Current Trend for US, or any other country, you may do so.

7. To see your twitter Home and Followers.

twitter: home
twitter: ls fl

See Twitter Followers

See Twitter Followers

See Twitter Followers

See Twitter Followers

8. T see list of all your friends, people whom you are following.

twitter: ls fr

See Twitter Friends

See Twitter Friends

Here is the list of commands you can run to handle your twitter tweets and feeds from your Linux terminal.

Command What it does
h Help
p Pause Twitter Stream for the client in your Terminal
r Resume Twitter Stream, which was Paused Earlier
c Clear the Linux Console
v Version Information of Twitter Client
q Quit Rainbow Stream
theme List all the available Themes
theme Name_of_Theme Apply the Theme e.g., theme monaki will apply monaki
Theme
notification See your Twitter Notification
whois @Avishek_1210 It will show Profile of @Avishek_1210
mentions It will show mentions timeline.
view @Avishek_1210 Show timeline of @Avishek_1210
s string It will search for word ‘string’. You may use it with/without
HashTag
t I Love #Tecmint It will Print I Love #Tecmint on Twitter
inbox Show your Inbox Messages
fl @Avishek_1210 Follow @Avishek_1210
ufl @Avishek_1210 Unfollow @Avishek_1210
block @Avishek_1210 Block @Avishek_1210
unblock @Avishek_1210 Unblock @Avishek_1210
report @Avishek_1210 Report @Avishek_1210 as SPAM Account
List home Show timeline of List

You can also perform Mathematical Calculation, which is a feature of Python simply as:

[@Avishek_1210]: 2*3
6
[@Avishek_1210]: 2**3
8
[@Avishek_1210]: 2+3
5
[@Avishek_1210]: 3-2
1
[@Avishek_1210]: 4/3
1

You can use cal command simply as if you would have done in terminal.

[@Avishek_1210]: cal
    August 2015       
Su Mo Tu We Th Fr Sa  
                   1  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
30 31                 

Want to have some fun with this application? Try and see what happens:

random_rainbow('Your Text Here')
OR
order_rainbow('Your Text Here')

Twitter Message

Twitter Message

So guys how is the application? Do you like this? If you are a Linux-er and used to Twitter, this application is for you. It is easy-to-setup and easy-to-use. Though I don’t use twitter very often but this application is really a rainbow and interesting and who knows I start using Twitter as much as Facebook, just because of interest in this command-line Twitter-client. This application is worth giving a try. Let your voice be audible. Provide us with your valuable feedback in the comments below. Like and share us and help us get spread.

Source

WP2Social Auto Publish Powered By : XYZScripts.com