Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Saturday, September 16, 2017

Ubuntu Tip Simple Backup Command Using CP

Ubuntu Tip Simple Backup Command Using CP


Backing up your computers hard drive is extremely important. Should the worst happen and you lose all of your important data, you need a way back. While there are many excellent utilities in the Ubuntu repositories that handle partial and full system backups. Sometimes a simpler solution is all that is needed.

Fortunately Ubuntu and Linux in general in fact comes with everything you need in the for of the very simple but also extremely powerful cp command. In case you havent figured it out yet, cp is Linux command line speak for copy. The examples below will show you how to use cp to back up your entire system.

sudo cp -r -u -x -v [source directory] [destination directory]

Example 1:
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE

sudo: Gives temporary root privileges.

cp: Linux command line copy command.

-r: Used with cp this switch causes cp to copy directory content recursively. Meaning it will copy all files and subdirectories in the directory being copied.

-u: Used with cp this switch causes cp to only copy files that have changed or dont already exist at the destination.

-x: Used with cp this switch stops cp jumping to other file systems which it will do if it encounters hard links or symbolic links.

This switch also stops cp eating its tail if you choose to back up your entire system. See examples 2 and 3 below.

-v: Used with cp this switch cause cp to give feed back on whats happening.

Full System Backup With CP
If we wish to perform a full system backup then we might feel inclined to use a command similar to that in Example 2 below. The trouble is without the -x switch cp will also attempt to backup the backup to the backup. Basically eating its own tail in a never ending loop until all disk space is used up.

This happens because all other file systems are mounted to a location branching from the root file system. So if root is / then home is mounted to /home. Within Ubuntu all USB drives tend to be mounted to /media/a_USB_drive, etc.

However with the -x switch the command in example 2 will not be enough to back up the entire system if there are several storage devices or file systems mounted to different mount points. To get around this problem we must write a small script that will backup each file system separately. Example 3 shows a small example where the root files system / and /home are backed up separately.

Example 2:
sudo cp -r -u -v / /media/MY_USB_DRIVE

Example 3:
#!/bin/sh
#
# cp based backup script.
#
sudo cp -r -u -x -v / /media/MY_USB_DRIVE
sudo cp -r -u -x -v /home/ /media/MY_USB_DRIVE

This script can be created in any text editor like gedit or nano. After the script has been saved it must be given permission to be run as a program. Example 4 shows the command needed to change to the directory/folder where the script is stored. How to apply execute permissions and how to run the script.

Example 4:
First open a terminal window if you havent already done so and enter the following commands. The actual location of your script is where you chose to save it.

cd /home/aikiwolfie/scripts/ (press enter)
chmod a+x my_backup_script (press enter)
./my_backup_script (press enter)

And thats it. Sit back and watch the backup script do its job.

download file now

Read more »

Wednesday, September 6, 2017

Uber CLI Quickly Get Uber Time To Pickup And Price Estimates From The Command Line

Uber CLI Quickly Get Uber Time To Pickup And Price Estimates From The Command Line


uber logo

Uber CLI is a tool to get time-to-pickup and price estimates for Uber from the command line. The application cannot be used to request Uber rides.

This is useful if you use Uber and the command line a lot, as its much faster than checking these details on your phone, especially if you create some Bash aliases for your home address and the places you frequently use Uber to get to.

The developer says that he created Uber CLI because "[...] as a lazy person it pains me every time [I] open my phone, open the Uber app, type my destination, and see the estimated price, only for my inner, responsible, cost-cutting, fiduciary-self to end up taking the bus all the way home. I think we can all agree that it would be much more efficient to simply be disappointed before I open my phone at all".


Installing and using Uber CLI


1. To install Uber CLI, youll need Node.js and npm.

For Ubuntu 16.04 and newer, you can use the Node.js and npm packages from the official repositories:
sudo apt install nodejs npm

For Ubuntu versions older than 16.04, youll need a newer Node.js/npm version. This can be installed by using the official Node.js repository. Youll find exact instructions HERE (in my test I installed Node.js 6.x in Ubuntu 14.04 and uber-cli installed without any issues).

2. Install Uber CLI

Before proceeding, you may wish to set up npm to allow installing packages globally without sudo. For how to do this, see our previous article. You can skip this and use the command below with sudo, but thats not recommended!

To install Uber CLI, simply type the following command in a terminal:
npm install uber-cli -g

Thats it. You can now start using Uber CLI. To get a time-to-pickup estimate, use the following command:
uber time pickup address
replacing pickup address with the address the Uber ride should pick you up.

Heres an example:
$ uber time 10 downing street london uk
?????????????????????????????????????????????????????
? 10 Downing St, Westminster, London SW1A 2AA, UK ?
?????????????????????????????????????????????????????
? ? ?
?????????????????????????????????????????????????????
? 2 min. ? uberPOOL,uberX,uberXL ?
?????????????????????????????????????????????????????
? 4 min. ? UberEXEC ?
?????????????????????????????????????????????????????
? 6 min. ? UberLUX ?
?????????????????????????????????????????????????????
? 8 min. ? uberASSIST ?
?????????????????????????????????????????????????????
? 17 min. ? uberWAV ?
?????????????????????????????????????????????????????
? 14 min. ? taxi ?
?????????????????????????????????????????????????????

You may skip the city and country - in my test, this worked without any issues, but I assume it is required in cases where there are multiple streets with the same name, etc.

To get price estimates, use the following:
uber price -s start address -e end address
replacing the start and end addresses with the actual locations.

Heres an example:
$ uber price -s 10 downing street london uk -e 221b baker street london uk
??????????????????????????????????????????????????????????????????????
? ? ? ? ? Surge ?
??????????????????????????????????????????????????????????????????????
? uberPOOL ? �10-�11 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? uberX ? �9-�12 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? uberXL ? �13-�17 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? UberEXEC ? �17-�23 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? UberLUX ? �27-�35 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? uberASSIST ? �9-�12 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? uberWAV ? �9-�12 ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? taxi ? ?undefined-?undefined ? 3.74 mi. ? 20 min. ? ?
??????????????????????????????????????????????????????????????????????
? ? 10 Downing St, Westminster, London SW1A 2AA, UK ?
??????????????????????????????????????????????????????????????????????
? ? 221B Baker St, Marylebone, London NW1 6XE, UK ?
??????????????????????????????????????????????????????????????????????

The blank cells in the examples above are Emoji, but I removed them so the columns dont get messed up. To get Emoji support in Linux, install the EmojiOne Color SVGinOT font (but note that it doesnt work properly with monospace formatted text and causes incorrect character alignment, or at least thats the case at the time Im writing this).

app seen @ desdelinux.net

download file now

Read more »

Thursday, August 31, 2017

Trash cli Manage Trash from Command line in Ubuntu Linux

Trash cli Manage Trash from Command line in Ubuntu Linux



By using a utility named trash-cli you can simply mange Trash from command line  

 The location of Trash folder in old GNOME version is (~/.Trash), in current versions it is in ~/.local/share/Trash. There is two sub folders named files and info. The files folder contains the files deleted and info directory consists of meta data for each deleted file.



First step, install trash-cli utility

$ sudo apt-get install trash-cli

It installs three commands,
1. list-trash to list down the files in trash
2. trash to move the file to trash
3. restore-trash to restore the file to original path

Usage:

$ trash love.txt      ( move the file love.txt to trash folder)

$ list-trash              (List the contents of Trash folder) 

       2011-10-27 22:46:28 /home/abc/love.txt



 $ restore-trash love.txt   (Restore the file love.txt) 

   0 2011-10-27 22:46:28 /home/abc/love.txt
What file to restore [0..0]: 0  (if there is more than one file list shows 1  2  3 etc)

download file now

Read more »

Sunday, August 13, 2017

Ubuntu Linux Install Google Chrome Browser Command

Ubuntu Linux Install Google Chrome Browser Command


You can get a fast, free web browser from Google. You will find binary packages for the Debian/Ubuntu/Fedora/openSUSE Linux. In this, FAQ Im going to explain how to install Chrome browser in three simple steps.

Step #1: Download Google Chrome

You need to visit the following url to grab the .deb file. Make sure you download 32 bit or 64 bit .deb version:Download Chrome Browser
Fig.01: Download Google Chrome 32/64 bit deb package for Ubuntu Linux
Fig.01: Download Google Chrome 32/64 bit deb package for Ubuntu Linux

Download 32 bit version

Open a terminal (press CTRL-ALT-t and type the following wget command to grab .deb file:
$ cd /tmp
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

Download 64 bit version using command line

Open a terminal (press CTRL-ALT-t and type the following wget command to grab .deb file:
$ cd /tmp
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

Sample outputs:
--2013-05-07 15:19:24-- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Resolving dl.google.com (dl.google.com)... 173.194.36.39, 173.194.36.35, 173.194.36.40, ...
Connecting to dl.google.com (dl.google.com)|173.194.36.39|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 42434828 (40M) [application/x-debian-package]
Saving to: `google-chrome-stable_current_amd64.deb
 
100%[======================================>] 4,24,34,828 466K/s in 89s
 
2013-05-07 15:20:53 (466 KB/s) - `google-chrome-stable_current_amd64.deb saved [42434828/42434828]
 

Step #2: Install .deb file

Type the following command to install 32 bit version:
$ sudo dpkg -i google-chrome-stable_current_i386.deb
Type the following command to install 64 bit version:
$ sudo dpkg -i google-chrome-stable_current_amd64.deb
Fig.02: Errors were encountered while processing

Step #3: Fixing "errors were encountered while processing" error

Type the following command to fix the error and install Chrome:
$ sudo apt-get -f install
Sample outputs:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libnss3-1d libxss1
The following NEW packages will be installed:
libnss3-1d libxss1
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 22.0 kB of archives.
After this operation, 162 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://in.archive.ubuntu.com/ubuntu/ precise-updates/main libnss3-1d amd64 3.14.3-0ubuntu0.12.04.1 [13.4 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ precise/main libxss1 amd64 1:1.2.1-2 [8,646 B]
Fetched 22.0 kB in 0s (23.6 kB/s)
Selecting previously unselected package libnss3-1d.
(Reading database ... 197880 files and directories currently installed.)
Unpacking libnss3-1d (from .../libnss3-1d_3.14.3-0ubuntu0.12.04.1_amd64.deb) ...
Selecting previously unselected package libxss1.
Unpacking libxss1 (from .../libxss1_1%3a1.2.1-2_amd64.deb) ...
Setting up libnss3-1d (3.14.3-0ubuntu0.12.04.1) ...
Setting up libxss1 (1:1.2.1-2) ...
Setting up google-chrome-stable (26.0.1410.63-r192696) ...
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/x-www-browser (x-www-browser) in auto mode.
update-alternatives: using /usr/bin/google-chrome to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode.
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

How do I use Google Chrome?

Simply type the following command:
google-chrome
google-chrome http://www.cyberciti.biz/

Or use GUI option > Press Windows key > Type Google or Chrome in unity search bar:
Fig.03: Starting Google Chrome browser

So there you have it-the ultimate and fast Google Chrome running on Ubuntu Linux:
Fig.04: Google Chrome in action


download file now

Read more »