New answers tagged

-1

cat /dev/null > /proc/PID/fd/4


-2

This will also clear the contents of a file cp /dev/null filename


2

You need to kill the process in order to free up the disk space. In future you can truncate the file using echo "" > file_name instead of deleting the file, if the file is being used by any running process.


-1

in: lsof -iTCP -Fp out: p1135 p6326 p16841 p18130 p37908 p41768 ...


1

The lsof command is quite full-featured, allowing you to specify many different search criteria. In particular, the -i option lets you search by Internet address, including protocol, rendering grep unnecessary. So you could replace lsof | grep TCP with lsof -i TCP lsof also allows you to specify which fields you are interested in with the -F option and ...


1

I think awk is good for this because it splits fields for you: lsof | awk '$8 == "TCP" { print $2 }' If field 8 is "TCP", then print field 2.



Top 50 recent answers are included