Powered By

Powered by Blogger

Tampilkan postingan dengan label command line. Tampilkan semua postingan
Tampilkan postingan dengan label command line. Tampilkan semua postingan

Senin, 29 November 2010

CLI Companion Reaches Version 1.0 RC2

Cli companion

CLI Companion is a tool aimed at making the terminal easier to use: it's a GUI that displays a list of commands and an embedded terminal under it. The application comes with a list of commonly used commands by default, each having a short description and if you want to find out more about a certain command, simply right click it and select "Help". This will display the "man" (manual) for the selected command. But CLI Companion can help advanced users too as you can use it to store long commands which you can then easily find using the search feature.



CLI Companion 1.0 RC2 has been released today, bringing 2 features designed to make CLI Companion more useful as a daily terminal:

  • the command list can now be collapsed and expand as needed (see screenshot below)
  • The format commands are stored in has been changed. Commands requiring User Input when ran now use question marks(?) as place holders. So a command like 'ls /any/directory' would be added to your command list as 'ls ?'. This changed was required because the old behavior only allowed user input at the end of the command.


Cli companion screenshot

To install the latest CLI Companion 1.0 RC2 in Ubuntu (Karmic, Lucid or Maverick), use the following commands:
sudo add-apt-repository ppa:clicompanion-devs/clicompanion-nightlies
sudo apt-get update
sudo apt-get install clicompanion

You'll then find CLI Companion under Applications > Accessories.

Kamis, 05 Agustus 2010

Display Google Calendar On Your Desktop Using Gcalcli And Conky

Google Calendar desktop ubuntu

This post explains how to display Google Calendar on your Desktop using Conky and Gcalcli (a tool you can use to manage Google Calendar via the command line).

If you already have a Conky instance running and want to also display Google Calendar on your desktop using Conky, see this how-to on running multiple Conky instances.


1. Install Gcalcli:
sudo apt-get install gcalcli


2. Configure Gcalcli

Unfortunately, Gcalcli needs your password in a configuration file in plain text. But then again, even Pidgin does this.

To be able to use Gcalcli, you have to create a configuration file in your home folder where you must add your Google username and password:

gedit ~/.gcalclirc

And paste this:
[gcalcli]
user: yourusername
pw: yourpassword

Replace yourusername and yourpassword with your Google username and password, then save the file.

3. Install conky
sudo apt-get install conky

4. Configure conky to display Google Calendar on your desktop
gedit ~/.conkyrc

And paste this:
alignment top_right
background no
border_width 0
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 5
gap_y 60
minimum_size 5 5
net_avg_samples 2
double_buffer yes
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no
text_buffer_size 8096

TEXT
${execi 300 gcalcli --nc --cals=owner calw 4}

Then save the file and start conky: press ALT + F2 and type: "conky".


5. Set Conky with Google Calendar to autostart:
gedit ~/conkystart

And paste this in the file:
#!/bin/bash
sleep 50 && conky

Then save the file and go to System > Preferences > Startup Applications, click "Add" and add a new startup application. Enter "Conky" under the name of the app and for the command, click "Browse" and then browse for the "conkystart" file in your home folder.


Gcalcli can also add events to Google Calendar and a lot of other stuff. See a complete how-to @ MakeTechEasier (this is also where we've found the Conky with Google Calendar on the desktop part).

Jumat, 23 Juli 2010

Upgrade youtube-dl To Get It Working Again [Download YouTube Videos Via Command Line]

YouTube keeps making changes to the website which breaks all YouTube download applications, including my favourite YouTube downloader called "youtube-dl". For this reason, we've backported the Maverick version for Ubuntu Karmic and Lucid users - and the updated version is available in the WebUpd8 PPA.

But before you install the latest youtube-dl, a little info on this amazing YouTube command line donwloader.


youtube-dl is a python script (comes in a .deb) for downloading videos from YouTube. The recent versions also support downloading videos from video.google.com, photobucket, dailymotion, and metacafe.

But it's not just fixing YouTube that's new in the latest youtube-dl. Here are some recent changes which are not in the Lucid version of youtube-dl:
  • add preliminary support for Dailymotion videos
  • support for WebM formats (vp8 + vorbis)
  • support for youtu.be URLs
  • add support for the "original" video format in YouTube
  • add a --max-quality option

And a lot more.

I'm not sure, but you might have to add the Gstreamer PPA for WebM support.


To install the latest youtube-dl in Ubuntu 10.04 Lucid Lynx and 9.10 Karmic Koala (but I've only tested it in Lucid), run the following commands in a terminal:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install youtube-dl


You can also manually download the .deb files if you want.


Using youtube-dl is very easy. To download a YouTube video, use the following command:
youtube-dl YOUTUBE-URL
where YOUTUBE-URL is the exact link to the YouTube video, like this (just an example): http://www.youtube.com/watch?v=BF14bWw1NKk

You can download all the available formats, like this:
youtube-dl --all-formats YOUTUBE-URL

For advanced options, type:
youtube-dl --help


If you're not using Ubuntu, you can grab the Python script from HERE.

Kamis, 22 April 2010

UNP Extracts Any Archive Via Command Line [Quick Linux Tip]

Here's a quick tip which many will find very handy. UNP is a small script which makes it very easy to extract almost any archive via command line. If you can't remember the command to extract tar.gz, rar and so on, you will love unp.


Basically to use unp, all you have to do is type:
unp your_archive
Where "your_archive" can be: rar, zip, tar.gz, deb, tar.gz2, rpm and so on. You can even use unp extract multiple archive types in the same time:
unp *.tar.gz, unp *.tar.bz, unp *.rpm, unp *.deb, unp *.zip, unp *.rar


Install unp


In Ubuntu, to install unp, simply paste this in a terminal:
sudo apt-get install unp

For other Linux distributions, search for "unp" in your package manager - it should be available in the official repositories.



Thanks to WebUpd8 reader RKV for the tip (oldie, but only today I remembered to write about it).

Kamis, 15 April 2010

Fish Gives Super TAB Powers To Your Shell [Linux]

fish

Fish is a user friendly command line shell. It features syntax highlighting, advanced tab completion features, discoverable help, a revised shell syntax and many other features.


Fish comes with a lot of features, but I find one feature truly amazing: tab completion for command line arguments, including explanations.

Example typing: "find -na", when pressing the TAB button completes it to "find name". Typing "find -a" and then pressing TAB will show all arguments that start with "-a" - and it also includes detailed explanations.

Here is a screenshot to understand better:

fish



Install Fish


Fish should be available in all major Linux distributions official repositories. In Ubuntu, install Fish using the following command:
sudo apt-get install fish


Then to run it, simply enter "fish" in a terminal.


You can read a lot more about Fish @ it's homepage.


P.s.: if you don't read this post without having in mind that "fish" is an application, it can be quite funny :)


Update: Bruce Ingalls tells us that: f you switch to a virtual, text-only terminal, you may experience problems starting fish, as I have. This can prevent you from logging in, especially if X Window is disabled.

Also (this comes from me): "sudo apt-get update && sudo apt-get upgrade" - doesn't work because the '&&' is not recognized. And most importantly, when setting Guake (a terminal emulator for Gnome) to use Fish, after restart it was using a few hundred mb of RAM. So it seems Fish has some sever issues!

Kamis, 11 Maret 2010

Make 'History' Show The Date For Each Command [Quick Linux Tip]

Vivek Gite @ Cyberciti has a really nice tip for the "history" command. Normally, running the command "history" in a terminal will give you an output which looks like this:

ubuntu linux history command output


Showing the exact date next to each command would be incredibly useful, don't you think? Have a look:

history with exact date linux



To achieve this, all you have to do is copy/paste the following commands in a terminal:
echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc

Selasa, 23 Februari 2010

3 Linux Console File Managers You Should Try: Midnight Commander (MC), Last File Manager (LFM) And VIFM

Image and video hosting by TinyPic
(in the screenshot above, you can see Lfm on top, Mc on the bottom left and Vifm on the bottom right corner, all running in Terminator)


GNU Midnight Commander (MC), Vifm and Last File Manager (Lfm) are 3 visual file manager applications for the Linux console. All of these 3 applications will remind you of Norton Commander - with the main interface consisting of two panels which display the file system -, but each has something special. Read about these 3 great console file managers for Linux and let us know your favourite in the comments!



1. Midnight Commander


midnight commander

Midnight Commander is probably the most well-known application of this kind and probably the most easy to use due to being the closest to Norton Commander and having the most common operations displayed at the bottom.

In Midnight Commander (MC), arrow keys control file selection, the insert key is used to select files and the Function Keys perform operations such as renaming, editing and copying files. It also supports mouse operations.

Midnight Commander's features include multiple file renaming (using wildcard characters), the ability to view the contents of RPM and DEB package files, to work with common archive formats as if they were simply another directory, an editor called mcedit and to function as an FTP or FISH client.


Mcedit seems really useful and it can be executed as standalone program or from Midnight Commander using F4 key. mcedit's features include syntax highlighting for many languages, macros, code snippets, simple integration with external tools, automatic indentation, mouse support, clipboard and more.

If you want to try Midnight Commander (and learn more about it), download it from HERE. Ubuntu users can install it by simply running the following command in a terminal:
sudo apt-get install mc



2. Last File Manager


lfm last file manager

Last File Manager (Lfm - based on curses and written in Python) is yet another easy to use console file manager which comes with 1-pane or 2-pane views. It's strongest assets are vfs for compressed files (so you can view archives just as if they were folders - just like MC, except Lfm doesn't seem to handle .deb and .rpm files), dialogs with entry competition, bookmarks, history, files colored by extension (although using the mime-type would sound more fair but that's nice anyway) and tabs.


Of course, those are just a few of Lfm features and you must try it out to see how great it is. I can tell you two other features which I love the most: direct find/grep integrations (and other tools) and a fast file viewer - pyview - with text and binary mode.


To download Lfm and learn how to use it, see it's HomePage. Ubuntu users can install Last File Manager using this command:
sudo apt-get install lfm



3. Vifm


Image and video hosting by TinyPic

We couldn't forget Vim lovers. Vifm is a ncurses based file manager with vi like key-bindings. Vifm is not for the average user and if you're not comfortable with Vim, it will take a while before you get used to it. However Vifm documentation page provides a few keyboard shortcuts to get you started.

You can set Vifm to either a 1 pane or 2 pane view, with the 2-pane view being able to serve either as two different classic panels, or one of the panels being used as quick file properties viewer (you can set quick file views in the pane with the :view command or view full screen file info with Ctrl + g).


For those who never used Vim, Vifm lets you cut with dd, paste with p, and rename a file with cw. Movement keys are the standard hjkl, with h and l ascending and descending the directory tree.

In the vifmrc configuration file you can set up your own commands and define simple rules regarding file types and the program to open them.

For more info on using Vifm, after installing it, type ":help" (you will also need vim installed).

Download Vifm from HERE. Ubuntu users can install Vifm using the following command:
sudo apt-get install vifm vim


So, do you use any of these console-based Linux file managers? If so, which is you favourite? Or maybe you use another one?


This post was suggested by rkv, so many thanks to him!

Jumat, 19 Februari 2010

Make "rm" Move Files To Trash Instead Of Completely Removing Them

To get the "rm" (but you can alias some other command like "del" or keep the original "trash" command!) command to move the file(s) to trash instead of removing them completely, you must install the trash-cli utility and set an alias for "rm" to use trash-cli. But trash-cli also removes folders, even without using the "-r" (recursive) option, so in this post I will share a script created by grizzly which will only remove folders when the "-r" argument is used.


Here is the complete mini-guide to setting "rm" to move files (and folders) to trash:


1. Install trash-cli

This package provides a command line interface trashcan utility compliant with the FreeDesktop.org Trash Specification. It remembers the name, original path, deletion date, and permissions of each trashed file.


In Ubuntu, simply run this command:
sudo apt-get install trash-cli


2. Set up the script

In Ubuntu enter this in a terminal:
sudo gedit /usr/local/bin/trash-rm

And paste this in the newly opened file, then save it:

#!/bin/bash
# command name: trash-rm
shopt -s extglob
recursive=1
declare -a cmd
((i = 0))
for f in "$@"
do
case "$f" in
(-*([fiIv])r*([fiIv])|-*([fiIv])R*([fiIv]))
tmp="${f//[rR]/}"
if [ -n "$tmp" ]
then
#echo "\$tmp == $tmp"
cmd[$i]="$tmp"
((i++))
fi
recursive=0 ;;
(--recursive) recursive=0 ;;
(*)
if [ $recursive != 0 -a -d "$f" ]
then
echo "skipping directory: $f"
continue
else
cmd[$i]="$f"
((i++))
fi ;;
esac
done
trash "${cmd[@]}"


Then make it executable by opening a terminal and running this:
sudo chmod +x /usr/local/bin/trash-rm


3. Create an alias for "rm" to use "trash-rm"

In Ubuntu, run this in a terminal:
gedit ~/.bashrc

and enter this at the end of the file:
alias rm="trash-rm"

and save it.

Then reload bashrc by running the following command in a terminal:
bash

That's it! Now try it out by deleting files the way you always do, using "rm" and "rm -r".


Final trash-cli tips


Since you've installed the trash-cli utility, now you can use the following commands for manipulating the trash from the command line (the names are self explanatory):
empty-trash
list-trash
restore-trash


Update: to get this to work for "sudo rm" as well, copy wilo108's sudo wrapper in your ~/.bashrc file. Without it, this will not work when "rm" is used with "sudo"!

Sabtu, 16 Januari 2010

Microdc2: Fastest Direct Connect (DC++) Client For Linux (Console)

Microdc2 is a command-line based Direct Connect (I will refer to it as DC++ because that's what most people call it even when not using DC++ - the application) client for Linux. What's so great about it is the speed and low system resources required (like for any shell application). Another thing I really like about Microdc2 is that you can basically browse the files like you would on your own computer: once you connect to a user, simply use basic commands like "cd", "ls" and so on.

Microdc2 doesn't have an option to directly download files like the standard DC++ so you must manually browse a user after searching for a file, but I was doing that anyway so I don't find this to be very inconvenient. And since the DC++ clients for Linux constantly freeze my computer, I decided to try a console application for Direct Connect and so I find out about Microdc2.


Installing and using Microdc2 (Ubuntu)



Installation

I tried compiling Microdc2 on my computer, but even though it only has a few dependencies, it fails. It could have something to do with it being pretty old. But I found an Ubuntu .deb file which, even though it was created with checkinstall, it works if you install the dependencies manually. So here is what you need to do:

1. Install the dependencies (you can also try to compile it if you want, download microdc2 source package from HERE):
sudo apt-get install libreadline5-dev libxml2-dev libbz2-dev


2. Then, simply download THIS Microdc2 .deb package.



Configuration

Microdc2 doesn't remember some settings so you have create a config file. To create one, enter this:
sudo gedit ~/.microdc2/config


And enter this:

# Set active or passive and listen port. Note: listen port must be set before active/passive
#set listenport xxxx
set active on


# The following address should be set to your external ip address.
set listenaddr xxx.xxx.xxx.xxx

# Set auto reconnect on
set auto_reconnect on

# These should all be pretty self-explanatory.
set description microdc2
set email my@email.com
set nick YOUR-NICKNAME
#set password xxxx
set downloaddir /path/to/downloads

# The set speed option doesn't actually change anything, it only changes your REPORTED speed that other users see. The slot is how many simultaneous downloads people can get from you.
set speed 100
set slots 40

#This is the hub connect command, must be the last command in the config file
#connect xxx.xxx.xxx.xxx:pppp

Edit the file as you wish, enable and disable options, etc.


Then, start Microdc2 by typing "microdc2" in a terminal. Then type "help" to see the available options. To understand easily, I've created a small video with some basic usage (connect to a DC++ Hub, search for a file, browse a user and start downloading a file):

Kamis, 14 Januari 2010

Newsbeuter: Command Line Feed Reader With Bloglines Sync Support [Linux, Mac OS X]

Newsbeuter

Newsbeuter is an open source command line feed reader for Linux, FreeBSD, Mac OS X and other Unix-like operating systems, which I really like. CenterIM also had a RSS feed reader, but I find Newsbeuter to be much better (although, for a IM client, CenterIM is awesome).

Here are a few of Newsbeuter features:
  • Subscribe to RSS 0.9x, 1.0, 2.0 and Atom feeds
  • Download podcasts
  • Freely configure your keyboard shortcuts
  • Search through all downloaded articles
  • Categorize and query your subscriptions with a flexible tag system
  • Integrate any data source through a flexible filter and plugin system
  • Automatically remove unwanted articles through a "killfile"
  • Define "meta feeds" using a powerful query language
  • Synchronize newsbeuter with your bloglines.com account
  • Import and exporting your subscriptions with the widely used OPML format
  • Freely define newsbeuter's look'n'feel through free color configurability and format strings



Here is a small video I've just recorded with Newsbeuter in action:



Installing and using Newsbeuter


Newsbeuter should be available in most Linux distribution repositories. Ubuntu users: Newsbeuter is available in the official repo, but not the latest version so if you want all the latest features, here is how to compile it (very easy - tested on Ubuntu Karmic Koala):

1. Install the packages needed for compiling (and Lynx as a browser):

sudo apt-get install libsqlite3-dev libstfl-dev libcurl4-gnutls-dev pkg-config libxml2-dev lynx checkinstall



2. Compile it:

Download Newsbeuter latest version and extract it, navigate to the folder where you extracted and:

make
sudo checkinstall --fstrans=no --install=yes --pkgname=newsbeuter --pkgversion "2:2.1-12ubuntu3" --default


As always, I prefer checkinstall to make install, so that a .deb package is installed for easier removal / update later on. You can, however, use "sudo make install" instead of checkinstall!


3. Using it

Before running Newsbeuter, add some feeds to it's configuration file or import an OPML file (from Google Reader or Bloglines for example):

a) manually enter feeds -> run this in a terminal:
sudo gedit ~/.newsbeuter/urls

and enter the feeds you want.

b) import an OPML file -> run this in a terminal:
newsbeuter -i /path/to/subscriptions.xml


entering the path to your OPML file in the above command.

Now you can start Newsbeuter:

a) running "newsbeuter" in a terminal window will start the application, but you will have to press "r" for every subscription you wish to refresh / get the latest news

b) running "newsbeuter -r" in a terminal will refresh all the RSS feeds after you start newsbeuter.

For more info on using Newsbeuter, type:
newsbeuter -h


and for help using it, press "h" while running Newsbeuter.

Sabtu, 26 Desember 2009

Upload Image To Imgur: Nautilus Actions Script [Linux]

cozzyd (Multumesc, Cosmin) Reddit user wrote a simple Nautilus Actions script to upload images to Imgur.com via right click.

To use it, make sure you have nautilus-actions, zenity and curl installed. In Ubuntu, install them using this command:
sudo apt-get install nautilus-actions zenity curl


Then, to set up the script, follow these steps:

1. Download the script and the .schema files from HERE.

2. Place the script wherever you want, and make it executable:
chmod +x imgur_upload


3. Go to System > Preferences > Nautilus Actions Configuration, select Tools > Import Assistant and select the downloaded .schema file.

4. Edit the command to point to where the imgur_upload script is located:

upload to imgur nautilus actions settings

Please note that the Nautilus Actions Configuration under Ubuntu Karmic looks different then it used to (I've just noticed this myself).

Once you have completed this, click the second button on the left called "Record all the modified actions".


You should now see an "Upload to Imgur" option when right clicking an image:


upload to imgur

And after uploading, a dialog should display the image url:

imgur


Note: if you don't use Nautilus, another reddit user (downdiagonal) come up with a curl command you can use to upload images to Imgur via command line. Simply add this to your .bashrc file (it should be in your home folder):

imgur(){
for i in "$@";do
curl -# -F "image"=@"$i" -F "key"="4907fcd89e761c6b07eeb8292d5a9b2a" http://imgur.com/api/upload.xml|\
grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<\(.*\)>/\x1B[0;34m\1:\x1B[0m /'
done
}



After that, reload bashrc with this command:
bash


Then, to upload an image to Imgur via command line, simply type:
imgur /path/to/image.jpg


The output will be something like this:
######################################################################## 100.0%
Original Image: http://imgur.com/dZ2iK.jpg
Large Thumbnail: http://imgur.com/dZ2iKl.jpg
Small Thumbnail: http://imgur.com/dZ2iKs.png
Imgur Page: http://imgur.com/dZ2iK
Delete Page: http://imgur.com/delete/hSvCvEt7uq


[via reddit]