16 July 2011

write a file to a different name in emacs with C-x C-w

get the propaganda tiles at http://goo.gl/TBnlv

vim file +n open file and go to line n

search the short manual page descriptions with apropos

save buffers and kill emacs with ctrl+x ctrl+c http://goo.gl/QMk98

Exiting Emacs

C-x C-c

Kill Emacs (save-buffers-kill-terminal).

C-z

On a text terminal, suspend Emacs; on a graphical display, “minimize” the selected frame (suspend-emacs).

from gnu.org

C-c C-x C-a to archive a branch in emacs org.mode

9.3 Archiving

When a project represented by a (sub)tree is finished, you may want to move the tree out of the way and to stop it from contributing to the agenda. Archiving is important to keep your working files compact and global searches like the construction of agenda views fast. The most common archiving action is to move a project tree to another file, the archive file.

C-c C-x C-a
Archive the current entry using the command specified in the variable org-archive-default-command.
C-c C-x C-s or short C-c $
Archive the subtree starting at the cursor position to the location given by org-archive-location.
The default archive location is a file in the same directory as the current file, with the name derived by appending _archive to the current file name. For information and examples on how to change this, see the documentation string of the variable org-archive-location. There is also an in-buffer option for setting this variable, for example

remove window title bars from maxed windows in gnome with compiz http://goo.gl/8OKZ0

find the number of pages in a pdf file with pdfinfo doc.pdf | awk /Pages/

save command history across terminals with add PROMPT_COMMAND="history -a; history -n" in your ~/.bashrc

found at reddit

in vim normal mode move to the end of the line with $ and the start with 0

more shortcuts at keyxl.com

at the cmd line ype ctrl+r string ctrl+r to cycle through the command history using a search string

from ubuntuforums.org

try export CDPATH=.:~:~/Dropbox if you use dropbox from the command line often

put it into ~/.bashrc to make the change permanent

more CDPATH information.

start vlc on the command line with vlc -I ncurses --random ~/Music

send vim to sleep with ZZ in normal mode

that's Shift+z Shift+z

in vim: type J in normal mode to append the next line to the current line

reload an irssi theme with /reload

take a quick screen capture with scrot -d 3 -c shot.jpg; eog shot.jpg

delete a sentence in the terminal with ctrl+x del OR ctrl+k ctrl+a

another trick is: ctrl+a # [enter] to save the line into history as a comment

convert .avi to .wav with mplayer -vo null -ao pcm:file=mywav.wav myavi.avi

restart network with sudo ifconfig eth0 down && sudo ifconfig eth0 up

show line numbers in vi with :set number

undo typing at the terminal with ctrl+_

consider keeping aliases in ~/.bash_aliases instead of ~/.bashrc

cut the last word on the command line with ctrl+w

12 July 2011

replace evolution with gnome-gmail in #ubuntu 11.04 http://goo.gl/rnirP

from askubuntu.com:

To work in Ubuntu 11.04 :
1) sudo apt-get install gnome-gmail
2) vim ~/.local/share/applications/mimeapps.list and add:

x-scheme-handler/mailto=gnome-gmail.desktop

register on a freenode irc server with /msg nickserv register [password] email

from plone.org:

Set your nick name in your client if it isn't already:

/nick YourNewNickname

Register your nick with the server:

/msg nickserv register YourPassword you@example.com

Follow the instructions given to verify the registration.

/msg NickServ VERIFY REGISTER YourNickName VerificationCode

Then log in with:

/msg nickserv register YourNickName YourPassword

11 July 2011

find where a binary is located in linux with type and whereis http://bit.ly/mPX8JJ via linuxscrew.com @artiomix

From www.linuxscrew.com

There are two commands that may help you to find where executable binary is located regardless it’s Unix or Linux system. They are whereis and type.

whereis locates source/binary and manuals sections for specified files and type tells what exactly shell executes when you type a certain command.

use keepassx and dropbox for a x-platform portable password manager

In Ubuntu, install keepassx with:
sudo apt-get install keepassx
Install Dropbox with:
wget http://linux.dropbox.com/packages/nautilus-dropbox_0.6.8_i386.deb; sudo dpkg -i nautilus-dropbox_0.6.8_i386.deb
Save your keepassx database file somewhere in your Dropbox directory.

10 July 2011

get the space in the current dir with du -ch http://goo.gl/1yMd6

If you do an:
ls -l
in any directory, the subdirectories give a zero byte value. This is a little bit offputting, as for example in the root directory /. all the directories show up a zero usage. A command exists for us to find out how much space these directories actually use, but it has nothing to do with ls.

From the command line, try typing:
du -c
, that will give you the usage on that particular directory. Du stands for Disk Usage, and -c is not the only switch that the program can accept. Try typing:
'man du'
, and come up with the various options that are available. An interesting one to try is:
du -ch
, which gives the space, and lists the space in human interpretable sizes, such as K, and Megs, rather than bytes.

via www.linux.ie

sudo the 2nd to last command with sudo !-2 via @linuxaria http://goo.gl/zoYSo

sudo !!
You wanted to give a command as root but you forgot to use sudo ? Don’t worry with this command you’ll use the history combined with sudo, the argument !! has the same meaning that !-1 , so this command runs your last command as root.

Obviously this could be used also as

sudo !-2

if you give another command after the one you want to run as root, but take care on which command are you running as root.

via linuxaria.com

chmod permissions explained via @ghacks http://goo.gl/xkVjZ

Remember, file permissions are in the form:

OWNER | GROUP | All Others

Each of those sections includes:

READ | WRITE | EXECUTE

Each permission (read, write, execute) is represented with the binary representation of the initial letter:

r – 4
w – 2
x – 1
To get the numeric permission you add which permissions you want to use together. So if you want r+w you get 6. If you want r+w+x you get 7. If you want r+x you get 5. If you want only r you get 4. So now, remembering you have to cover permissions for three different users (Owner, Group, All Others), you will need to have a numeric number for each. So if you want Owner and Group to have rwx permission and All Others to only have r permissions, you would have:

774

Now, to change the permission of a particular file to 774 you would issue the command:

chmod 774 FILENAME

Where FILENAME is the name of the file.

via www.ghacks.net

visit switchroot.com for linux and programming tips and tutorials and howtos http://goo.gl/rf8Ht

shutdown immediately with shutdown -h now http://goo.gl/CaJ9P


Shutdown the machine immediately

You can shutdown the machine immediately using the following command. It notifies all the logged in users about the system going down, and shuts down the machine.
# shutdown -h now

Broadcast message from sathiya@sathiya-laptop
(/dev/pts/1) at 11:28 ...

The system is going down for halt NOW!

via linux.101hacks.com

why you should use gksudo or kdesudo instead of sudo to run graphical applications http://goo.gl/rJsUZ


These errors occur because sometimes when sudo launches an application, it launches with root privileges but uses the user's configuration file. For example, if you launch Firefox with the command
gksudo firefox
it uses root's Firefox configuration file. But if you launch Firefox with the command
sudo firefox
it runs with root privileges but uses the user's configuration file (in this case, you can see the homepage and theme are different).Change a few settings while launched as root, and you'll see if you dig into your Firefox profile that certain files are now owned by root.

via psychocats.net

secure delete with shred -vfz -n 10 /dev/hda http://goo.gl/s4kc via @stackfeed

Use the "shred" command:
Suppose I want to erase all the data on my hard disk, then I boot using a LiveCD like Knoppix and open a shell and type the following command:

shred -vfz -n 10 /dev/hda


Here /dev/hda is my whole hard disk. And I am asking shred to make (-n) 10 passes by overwriting the entire hard disk with (-z) zeros. And shred program (-f) forces the write by changing the permissions wherever necessary.
10 passes is probably way overkill, I'm not aware of a single confirmed example of someone recovering data from an erased disk even after 1 pass. Its a time-paranoia trade off.

save a read only file in #vim with :w !sudo tee % http://goo.gl/BPFTd | via @commandlinefu

Save a file you edited in vim without the needed permissions | commandlinefu.com

#vi "xy5b to yank the preceding 5 words into a buffer named x #linux

try Buuf-gnome-1.7-r2 icon theme by ~djany http://goo.gl/Zmupg



manage your podcast feeds with #gpodder http://goo.gl/Ig3uX

gPodder, a free podcast aggregator for Linux, FreeBSD, Windows, Maemo and MeeGo: "gPodder — simple, usable podcast consumption

Download free audio and video content ('podcasts') from the Internet and watch it on your computer or on the go.

Available in most Linux distributions, FreeBSD, for Windows, on the N800 (running OS2008), N810 and the N900 (running Maemo 5). Also available soon for the Nokia N9 (running MeeGo 1.2 Harmattan), the N950 and other MeeGo devices."

Pages