Friday, November 22, 2013
Monday, November 18, 2013
Activate/Deactivate wifi on openSUSE asks for administrator password
I was very annoyed by the behavior of Network Manager in openSUSE 12. Every time I want to enable/disable the wifi and want to automatically connect to my prefered wifi spot, the system asks for the administrator password...
This can be changed by editing the file /etc/polkit-default-privs.local and add :
then run the command :
So now current logged user can enable or disable the wifi connection without the administrator password... Enjoy.
This can be changed by editing the file /etc/polkit-default-privs.local and add :
org.freedesktop.NetworkManager.enable-disable-wifi yes
then run the command :
# set_polkit_default_privs
So now current logged user can enable or disable the wifi connection without the administrator password... Enjoy.
Wednesday, November 13, 2013
VIM tips
Vim in read-only mode : view
Did you know that vim has a read-only mode ?Just use :
# view myfile.txt
Searching for the current word :
In normal mode, move the cursor to any word. Press*
to search forwards for the next occurrence of that word, or press #
to search backwards.Delete "empty" lines :
Sometime you can be annoyed by "empty" lines which contains no character in your file, to delete them you can use :
:g/^$/d
:g will execute a command on lines which match a regex. The regex is "empty line" (start with nothing and end with nothing) and the command is :d for delete
Delete "blank" lines :
Beside "empty" line, you might want to delete lines which contains only whitespaces characters (spaces/tabs) in your file :
:g/^\s*$/d
Visual block editing :
Activate the visual block mode :
CTRL+v
Insert Mode before every line of the block :
SHIFT+i
Apply the insert :
ESC
Wednesday, November 6, 2013
Process tracking on Linux
Some useful tricks to track a process running in your Linux system.
Example with :
Example :
Example :
How to track in real time a specific process by his name :
The top command is very useful to see what's going on in your system, but sometimes there is too much processes monitored, so here is a trick to show only "procname1" and "procname2" in top :
# top -p $(pgrep procname1 | xargs echo | sed -e 's/ /, /g') -p $(pgrep procname2 | xargs echo | sed -e 's/ /, /g')
Example with :
# top -p $(pgrep httpd | xargs echo | sed -e 's/ /, /g') -p $(pgrep nfs| xargs echo | sed -e 's/ /, /g')
How to track any processes waiting for disk I/O :
# watch -n 1 "(ps aux | awk '\$8 ~ /D/ { print \$0 }')"
Example :
How to find out which processes are swapping :
# for i in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $i; done | sort -k 2 -n -r | less
Example :
Subscribe to:
Posts (Atom)