This is done using the %{VENDOR} tag. For example:-
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE} %{VENDOR}\n'
Tuesday, 3 September 2013
Monday, 2 September 2013
Highlight all occurences of selected word in vi
To do this:-
:set hlsearch
To undo this:-
:nohlsearch
:set hlsearch
To undo this:-
:nohlsearch
Labels:
vi
Rebuild RPM DB
This may need to be done in instances where simple commands such as rpm -qa hang. Steps:-
- Kill all rpm and yum processes
- yum clean all
- rm -f /var/lib/rpm/__db*
- rpm -v --rebuilddb
- yum makecache
Labels:
rpm
Tuesday, 23 July 2013
Mac Tips and Tricks
Recently I have been using a Macbook Pro for work (OS X 10.8.3), it's good but I have come across a few things that I am not used to and have discovered ways to fix them.
Using Mac with regular UK keyboard
There are several problems:-
- Hash key in the wrong place
- @ key in the wrong place
- " key in the wrong place
- | symbol in the wrong place
- ~ key in the wrong place
- Home and End keys don't work
- Copy and paste are apple + c and apple + v
With regards to the standard keys there are several keyboard layouts you can download and use, the best of which I can find is the British (PC 105 alt) downloaded from the following location:-
http://liyang.hu/osx-british.xhtml
With regards to home and end keys see the following:-
http://lifehacker.com/225873/mac-switchers-tip--remap-the-home-and-end-keys
However the home and end keys still won't work in firefox! For this install the KeyFixer add-on:-
https://addons.mozilla.org/en-US/firefox/addon/keyfixer/?src=search
With regards to copy and paste keys, you can go to System Preferences > Keyboard > Keyboard Shortcuts and set Application Keyboard Shortcuts > All Applications > Add Shortcut
- Copy ^C
- Undo ^Z
- Cut ^X
- Paste ^V
Scroll doesn't work the same way
This is an easy one to change. Go to System Preferences > Trackpad > Scroll and Zoom > Scroll Direction: natural - untick this.
Useful Software to install
iTerm2 - pretty similar to terminator in linux (which can also be installed for Mac):-
http://www.iterm2.com/#/section/home
csshX - cluster ssh for Mac:-
http://code.google.com/p/csshx/
Using Mac with regular UK keyboard
There are several problems:-
- Hash key in the wrong place
- @ key in the wrong place
- " key in the wrong place
- | symbol in the wrong place
- ~ key in the wrong place
- Home and End keys don't work
- Copy and paste are apple + c and apple + v
With regards to the standard keys there are several keyboard layouts you can download and use, the best of which I can find is the British (PC 105 alt) downloaded from the following location:-
http://liyang.hu/osx-british.xhtml
With regards to home and end keys see the following:-
http://lifehacker.com/225873/mac-switchers-tip--remap-the-home-and-end-keys
However the home and end keys still won't work in firefox! For this install the KeyFixer add-on:-
https://addons.mozilla.org/en-US/firefox/addon/keyfixer/?src=search
With regards to copy and paste keys, you can go to System Preferences > Keyboard > Keyboard Shortcuts and set Application Keyboard Shortcuts > All Applications > Add Shortcut
- Copy ^C
- Undo ^Z
- Cut ^X
- Paste ^V
Scroll doesn't work the same way
This is an easy one to change. Go to System Preferences > Trackpad > Scroll and Zoom > Scroll Direction: natural - untick this.
Useful Software to install
iTerm2 - pretty similar to terminator in linux (which can also be installed for Mac):-
http://www.iterm2.com/#/section/home
csshX - cluster ssh for Mac:-
http://code.google.com/p/csshx/
Labels:
mac
Friday, 14 June 2013
Tips and Tricks
Make ps more readable and put on separate lines
Awk print from third column to the end
ps -ef | grep java | tr " " "\n"
Show hidden files with du
du -sk .[!.]* *| sort -n
Show just hidden files with du
du -sh .[a-zA-Z]*
Trim last character in vi
:%s/.$//g
With sed
sed '$s/.$//'
Awk, print all on one line with a comma seperating
awk '{ printf "%s,", $1 }'
Find command with regex
find . -name \*[Ii]nstall\*[Ll]og\*
Remove all blank lines with awk
awk '/./' abc.txt
Show octal permissions when doing an ls
for file in `ls`; do echo -n `stat -c %a $file`; echo -n " "; ls -ltd $file; done
Using awk with a field seperator
awk 'BEGIN { FS = "," } ; { print $1 }'
Remove HTML tags from a file
sed "s/<[^>]\+>//g" file
Awk print from third column to the end
awk '{ print substr($0, index($0,$3)) }'
Monday, 3 June 2013
Passwordless ssh with Puppet
This can be achieved with the ssh_authorized_key resource type.
Before doing this in puppet you need to generate a key on the host you want to ssh from. From within the user account you want the ssh access to occur from:-
Take a copy of the key text from /home/username/.ssh/authorized_keys. This should just be the key part not the ssh type or user and hostname. Also take a copy of the type and the user and hostname part.
Within puppet do the following:-
In the above the details from the authorized_keys file are found:-
You should know be able to ssh without a password
ssh-keygen
Take a copy of the key text from /home/username/.ssh/authorized_keys. This should just be the key part not the ssh type or user and hostname. Also take a copy of the type and the user and hostname part.
Within puppet do the following:-
ssh_authorized_key {
"andy@ahibbert":
ensure => present,
user => andy,
type => "ssh-rsa",
key => "AAAAB....."
}
In the above the details from the authorized_keys file are found:-
- andy@ahibbert - user and hostname I'm ssh'ing from
- type - the ssh type I am using
- key - the public ssh key
puppet apply auto_ssh.pp
You should know be able to ssh without a password
Labels:
Puppet
Subscribe to:
Posts (Atom)