Running out of Disk Space ?
want to see which files are the largest files on your system and are contributing to filling up your hard disk.
Copy and paste the following command into your terminal. and run it in your root directory.
find . -type f -print0 | xargs -0 du -h | sort -hr | head -20
This will list the 20 Largest files on your System, and report their size in human readable format.
better still, copy and paste the line into a file,
name the file bigfiles
save the file in /usr/local/bin
chmod +x /usr/local/bin/bigfiles
then from anywhere on your system simply type
bigfiles
Friday, March 30, 2012
Saturday, March 24, 2012
Pimp your Tail command
The default settings of the TAIL command is to output the last 10 lines of a file
eg
tail /var/log messages
will output the last 10 lines of your /var/log/messages file
Mar 24 11:25:20 mirage dbus-daemon[1094]: dbus[1094]
Mar 24 11:25:20 mirage dbus[1094]: [system] Successfully activated service 'org.freedesktop
Mar 24 11:27:44 mirage dbus-daemon[1094]: dbus[1094]: [system] Activating service name
Mar 24 11:27:44 mirage dbus[1094]: [system] Activating service name='net.reactivated
Mar 24 11:27:44 mirage dbus-daemon[1094]: Launching FprintObject
Mar 24 11:27:44 mirage dbus[1094]: [system] Successfully activated service 'net.reactivated.Fprint'
Mar 24 11:27:44 mirage dbus-daemon[1094]: dbus[1094]: [system]
Mar 24 11:27:44 mirage dbus-daemon[1094]:
Mar 24 11:27:44 mirage dbus-daemon[1094]: ** Message: entering main loop
This alias changes the default setting of tail so that it outputs all the lines that can fit on your screen.
just add the following to your .bashrc if you use bash or your .zshrc if you use zsh as your terminal editor.
alias tail='tail -n $((${LINES:-`tput lines 2>/dev/null||echo -n 80`} - 7))'
then source youre .bashrc or .zshrc by typing
source .bashrc or
source .zshrc
or just restart your terminal
next time you run tail on a file you will get as many lines as will fill up your screen.
Sunday, March 18, 2012
play and edit MT2S files
MT2S files are High Definition Sony Blue ray AVCHD Files,
commonly produced by High Definition Camcorders.
To use edit and play these files on your Linux system
Openshot video editor works well as a video editor
yum install openshot or apt-get install openshot
although VLC can play these files you need to make the following changes to VLC so that they play well.
open up VLC
Go to Tools -->Preferences --> Input & Codecs
on the option “Skip the loop filter for H.264 decoding” select ALL
Then in preference window Click Show Settings -> All. and expand Stream Output ->
Click Muxers ->select Mux module as “FFmpeg muxer”
next click
Expand Video -> Select Output module -> In Video Output module and select X11 video output.
and then save your settings
MT2S high definition files should play much more smoothly in VLC now.
Wednesday, March 7, 2012
Disable top left corner mouse Hotspot in Gnome 3
In Gnome 3, moving your mouse into the top left corner of your screen, simulates pressing (Alt-f1) or the Windows key, and puts you into search mode. This can be extremely annoying when it happens accidentally.
I prefer to only use the Keyboard for this feature.
to Disable the Mouse hotspot edit the following file
vim /usr/share/gnome-shell/js/ui/panel.js
then search for the following line
this._hotCorner.actor.allocate(hotBox, flags);
and comment it out, by putting // infront of it
like so
// this._hotCorner.actor.allocate(hotBox, flags);
save the file, and logout/login to your Gnome session.
no more annoying mouse hotspot.
to Disable the Mouse hotspot edit the following file
vim /usr/share/gnome-shell/js/ui/panel.js
then search for the following line
this._hotCorner.actor.allocate(hotBox, flags);
and comment it out, by putting // infront of it
like so
// this._hotCorner.actor.allocate(hotBox, flags);
save the file, and logout/login to your Gnome session.
no more annoying mouse hotspot.
my .zshrc file
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=10000
setopt autocd
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/cgerada/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
#the following lines were added by cgerada
#autocompletion of hostname from ,ssh/known_hosts
local _myhosts
_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
zstyle ':completion:*' hosts $_myhosts
#Spelling autocorrect
setopt correct
#coloured prompt
autoload -U colors && colors
PS1="%{$fg_bold[green]%}%n%{$reset_color%}@%{$fg_bold[blue]%}%m %{$fg_bold[yellow]%}%~ %{$reset_color%}%% "
# right hand prompt simple date and time only
RPROMPT="[%D,%T]"
#Extension aliases very cool
alias -s doc=libreoffice
alias -s xls=libreoffice
alias -s doc=libreoffice
alias -s pdf=evince
~
~
~
~
~
Moving from Bash to ZSH
I have Stopped using Bash and am now using ZSH as my new shell of Choice.
ZSH has many awesome features that make it a No brainer (for me anyway) to make the switch
Here's what I love about ZSH
1:) Your History is shared across sessions. Multiple simultaneously running zsh sessions can share history with each other. how many times have you looked into your bash history to find a recent command that you used, only to find that that command was run on a different terminal session and is no longer available to you.
2:) Tab Auto completion works between remote machines over SSH.
rsync -avr remotemachine:/home/cgerada/Documents/very/long/directory/na (at this point you can hit tab and provided that you connect to your remote host using ssh Key authentication instead of password authentication zsh will autocomplete for you.
3:)No need to type cd to change into a Directory.
/home/cgerada/directory enter
will change to /home/cgerada/directory for you.
Considering how often you use the cd command, this is a real time saver.
4:) Tab auto completion works for command options
rsync -av (hit tab here) will show you all possible options for the rsync command
5:) Built in Spell check
How many times have you typed something like aptg-et or other mangled commands? Well,
if you do that in zsh,You get a message asking: “zsh: correct 'aptg-et' to 'apt-get' [nyae]? “
6:) Built in pager.
If your Lazy like me. And I think you are. zsh comes with a pager directly in the shell. This means you
can type things like " > README
7:)Right hand prompt
Zsh supports a second (right hand prompt) great for adding the date and time (see screen shot above)
or if you own a laptop you can also display your Battery capacity. The right hand prompt will not get in
your way as it disappears when your typing reaches it. or you can just not enable it if you don't want it.
8:) Known hosts auto completion. ZSH can even tab autocomplete hostname entries of remote machines that
you connect to from your .ssh/knownhosts file.
in fact auto completion in all areas is far more superior in ZSH.
9:) Extension aliases
alias -s doc=libreoffice
putting the above in your .zshrc file allows you to open up a .doc file simply by typing its filename. eg
officedoc.doc [enter]
will open up officedoc.doc using libre office (in Bash you would have had to type
libreoffice officedoc.doc
you can do the same for all extensions eg
alias -s pdf=evince
ZSH has loads more awesome features, and is highly customizable . it behaves extremly similar to bash, in fact you can use it exactly the way you use bash and not learn or change a single thing and you won't be missing anything.
Right, so if you are convinced to make the change and jump right in.
install zsh by typing yum install zsh or apt-get install zsh.
once installed simply type
chsh to change your shell .
you will be asked for your user password
once typed in correctly you will be asked
New shell [/bin/bash]
type /bin/zsh enter
and the next time you log into your shell with your username you will be in the ZSH shell.
If for what ever reason, you do not like zsh and want to revert back to bash
simply type
chsh
enter your password once again
and then type
/bin/bash
will change your shell back to Bash.
Subscribe to:
Posts (Atom)