Troca de conhecimentos sobre o uso da linha de comando e referencia direta ao site commandlinefu.com.
Show git branches by date - useful for showing active branches
8 de Junho de 2009, 0:00 - sem comentários ainda$ for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
Print out list of all branches with last commit date to the branch, including relative time since commit and color coding.
Options:
commandlinefu.com by David Winterbottom
Create a nifty overview of the hardware in your computer
7 de Junho de 2009, 0:00 - sem comentários ainda$ lshw -html > hardware.html
After the command is done, open the html file in a browser
Options:
commandlinefu.com by David Winterbottom
Find if the command has an alias
7 de Junho de 2009, 0:00 - sem comentários ainda$ type -all command
Options:
commandlinefu.com by David Winterbottom
coloured tail
5 de Junho de 2009, 0:00 - sem comentários ainda$ tail -f FILE | perl -pe 's/KEYWORD/\e[1;31;43m$&\e[0m/g'
tail with coloured output with the help of perl - need more colours? here is a colour table:
Options:
commandlinefu.com by David Winterbottom
Shutdown a Windows machine from Linux
4 de Junho de 2009, 0:00 - sem comentários ainda$ net rpc shutdown -I ipAddressOfWindowsPC -U username%password
This will issue a shutdown command to the Windows machine. username must be an administrator on the Windows machine. Requires samba-common package installed. Other relevant commands are:
net rpc shutdown -r : reboot the Windows machine
net rpc abortshutdown : abort shutdown of the Windows machine
Type:
net rpc
to show all relevant commands
Options:
commandlinefu.com by David Winterbottom
create an emergency swapfile when the existing swap space is getting tight
4 de Junho de 2009, 0:00 - sem comentários ainda$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000;sudo mkswap /swapfile; sudo swapon /swapfile
Create a temporary file that acts as swap space. In this example it's a 1GB file at the root of the file system. This additional capacity is added to the existing swap space.
Options:
commandlinefu.com by David Winterbottom
Relocate a file or directory, but keep it accessible on the old location throug a simlink.
4 de Junho de 2009, 0:00 - sem comentários ainda$ mv $1 $2 && ln -s $2/$(basename $1) $(dirname $1)
Used for moving stuff around on a fileserver
Options:
commandlinefu.com by David Winterbottom
Compare two directory trees.
4 de Junho de 2009, 0:00 - sem comentários ainda$ diff <(cd dir1 && find | sort) <(cd dir2 && find | sort)
This uses Bash's "process substitution" feature to compare (using diff) the output of two different process pipelines.
Options:
commandlinefu.com by David Winterbottom
Share a 'screen'-session
4 de Junho de 2009, 0:00 - sem comentários ainda$ screen -x
Ater person A starts his screen-session with `screen`, person B can attach to the srceen of person A with `screen -x`. Good to know, if you need or give support from/to others.
Options:
commandlinefu.com by David Winterbottom
Find last reboot time
4 de Junho de 2009, 0:00 - sem comentários ainda$ who -b
Displays time of last system boot
Options:
commandlinefu.com by David Winterbottom