Tag Archives: Linux How to

Unix Similar multi-user operating systems based on the Linux kernel and essentially on GNU software. Like CentOS, Debian, Ubuntu Fedora.

Nemo Action Context Menu Extract Here

Add Compress and Extract here Action to Nemo File Manager as Context Menu

Nemo is the amazing file manager of Cinnamon’s desktop environment. It’s a further development of Gnome’s Nautilus file manager with easy customization options. Adding a context menu to unpack and compress folders and files is a simple task.

Add action compress and extract to Nemo

Adding the context menu action for compress and extract in Nemo will show in this tutorial. We open a terminal and copy & paste the following content into the path see below and save it as file compress.nemo_action

$ xed ~/.local/share/nemo/actions/compress.nemo_action
[Nemo Action]
Active=true
Name=Compress...
Comment=compress %N
Exec=file-roller -d %F
Icon-Name=gnome-mime-application-x-compress
Selection=Any
Extensions=any;

As well as the entry for extract archives action into file extracthere.nemo_action

$ xed ~/.local/share/nemo/actions/extracthere.nemo_action
[Nemo Action]
Active=true
Name=Extract here
Comment=Extract here
Exec=file-roller -h %F
Icon-Name=gnome-mime-application-x-compress
Selection=Any
Extensions=zip;7z;ar;cbz;cpio;exe;iso;jar;tar;tar;7z;tar.Z;tar.bz2;tar.gz;tar.lz;tar.lzma;tar.xz;

Nemo shows compress and extract here

Then a right click on an archive file shows the context menu with compress and extract here.

Nemo Action Context Menu Extract Here
Nemo context action menu (right-click)

Action context compress extract for any user

This enable the action context menu compress and extract to Nemo for the current user only, if you prefer the ability for any user, then move the file compress.nemo_action and extracthere.nemo_action into /usr/share/nemo/actions, you need root privileges to can do it.

$ sudo mv ~/.local/share/nemo/actions/*.nemo_action /usr/share/nemo/actions
Nemo File Manager

 The common compression tools are preinstalled on most distos. 7-Zip is another all in one compression tool and very popular by Sysops, this can be installed with the following command.

$ sudo yum install -y p7zip p7zip-plugins

Send E-Mail using cURL

How to send e-mail over an SMTP gateway using cURL

cURL in combination with command-line options send an e-mail to a recipient. Originally the name cURL meant “see URL” and was later reinterpreted to the current Backronym cURL.

The basic command for send an e-mail using cURL.

$ curl smtp://mail.server.com --mail-from sender@domain.com --mail-rcpt
receiver@domain.com --upload-file email.txt

Example: cURL send e-mail using SMTP in the terminal emulator:

$ curl -v smtp://mail.server.com/email.com --mail-from don@email.com --mail-rcpt rosa@email.com --upload-file email.txt

The following is the output in the terminal:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 10.12.15.13...
* TCP_NODELAY set
* Connected to mail.server.com (10.12.15.13) port 25 (#0)
< 220 mail.server.com ESMTP
> EHLO email.com
< 250-mail.server.com
< 250-PIPELINING
< 250-SIZE 22000000
< 250-ETRN
< 250-ENHANCEDSTATUSCODES
< 250-8BITMIME
< 250 DSN
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0> MAIL FROM:<don@email.com> SIZE=355
< 250 2.1.0 Ok
> RCPT TO:<rosa@email.com>
< 250 2.1.5 Ok
> DATA
< 354 End data with <CR><LF>.<CR><LF>
} [355 bytes data]
* We are completely uploaded and fine
< 250 2.0.0 Ok: queued as B744B28008
100   355    0     0  100   355      0    355  0:00:01 --:--:--  0:00:01  1334
* Connection #0 to host mail.server.com left intact

Using -v parameter to generates verbose output.

email.txt is uploaded and sent e-mail by cURL over the SMTP gateway.

From: Don <don@email.com>
To: Rosa <rosa@email.com>
Subject: This is an example with cURL SMTP
Date: Sam, Jan 19, 2019 12:50:16 PM

Hello Rosa,
Welcome to cURL email, today is a beautiful day.

The content of email.txt take From, To, Subject, Date as data fields that serves the Simple Mail Transfer Protocol. To send e-mail by curl.

  The Mail Transfer Agent (MTA) must be configured to accept e-mail from the host that uses cURL on it, if it is not an MTA itself, a directive must be configured with smtpd_sender_restrictions, e.g. smtpd_client_restrictions.

What is cURL

curl is a command-line tool for getting or sending data including files using URL syntax. Since curl uses libcurl, it supports every protocol libcurl supports.

It was first released in 1996. It was originally named httpget and then became urlget before adopting the current name of cURL. The original author and lead developer is the Swedish developer Daniel Stenberg, who created cURL because he wanted to automate the fetching of currency exchange rates for IRC users.

Client URL (“curl”) is a command line tool that enables data exchange between a device and a server through a terminal. Using this command line interface (CLI), a user specifies a server URL (the location where they want to send a request) and the data they want to send to that server URL, like send an e-mail by curl.

API tools like Postman and Insomnia provide an interactive user interface (UI) that allows you to make different forms of requests to URLs, for receiving and processing requests. The cURL command does the same thing, except in your terminal. cURL works on Linux, Mac, and Windows.

The cURL command uses the libcURL client-side URL transfer library. This library supports many different transfer protocols including HTTPS, SMTP, and FTP. It also enables you to include cookies, set proxies, and add authentication credentials when making requests.