Wiki@CSUSP

Sismologia, Sismologia, Sismologia!

Ferramentas do usuário

Ferramentas do site


soft:20_comandos_uteis

20 Comandos Úteis

1. Drag about how much free RAM you have on Linux:

free

2. Where is that application I just installed (all directories)

whereis [app]

3. Disk space usage

df -h

4. To make a playlist of the audio files in a folder

ls -R > playlist.m3u

5. To kill a process by it's name:

sudo killall <prog_name>

for instance: sudo killall firefox. Or you can kill by pid (program id):

sudo kill <pid>

and to see the pid:

pidof <program name>

for instance: pidof firefox or you can try listing the currently running processes with:

ps -e

6. To find out the version of installed software:

apt-cache policy <packet_name>

7. To find out the UUID of your partitions:

ls /dev/disk/by-uuid/ -alh

8. Display the top ten running processes - sorted by memory usage:

ps aux | sort -nrk 4 | head

9. Set audible alarm when an IP address comes online

ping -i 60 -a IP_address

10. Mount a .iso file in UNIX/Linux:

mount /path/to/file.iso /mnt/cdrom -oloop

11. Sharing a file through http 80 port:

nc -w 5 -v -l -p 80 < file.ext

From the other machine open a web navigator and go to ip from the machine who launch netcat, “http://ip-address/” If you have some web server listening at 80 port then you would need stop them or select another port before launch net cat ;-) P.s.: You need netcat tool installed

12. Allows system wide changes:

su

13. Converts a single FLAC (or APE) file with associated cue file into multiple FLAC files:

cuebreakpoints "$2" | shnsplit -o flac "$1"

Requires: - cuetools - shntools

14. Add the ID3 tags in a cue file to the flac files:

cuetag *.cue *.flac ;

Requires: - cuetools

15. Extract audio stream from an AVI file using mencoder:

mencoder "${file}" -of rawaudio -oac mp3lame -ovc copy -o audio/"${file/%avi/mp3}"

16. Capture video of a linux desktop:

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

17. Download an entire website:

wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com

-p parameter tells wget to include all files, including images. -e robots=off you don't want wget to obey by the robots.txt file -U mozilla as your browsers identity. –random-wait to let wget chose a random number of seconds to wait, avoid get into black list. Other Useful wget Parameters: –limit-rate=20k limits the rate at which it downloads files. -b continues wget after logging out. -o $HOME/wget_log.txt logs the output

18. Kill: a process that is locking a file:

fuser -k filename

19. Don't miss the next PI or 234567890 day, find out current unix time:

date +%s

20. Scans for open ports using telnet:

HOST=127.0.0.1;for((port=1;port<=65535;++port)); do echo -en "$port ";if echo -en "open $HOST $port\nlogout\quit"  |  telnet 2>/dev/null |  grep 'Connected to' > /dev/null; then echo -en "\n\nport $port/tcp is open\n\n";fi;done | grep open
soft/20_comandos_uteis.txt · Última modificação: 2010/07/16 16:59 (edição externa)