Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When you execute a command that takes a long time to run and you want to send it to the background you can do:

ctrl + z

then, to send it to the background:

bg

and, to get it back from the background:

fg

Also, I really like to use "for", like:

// get the size of each file or directory in the current directory

for i in `ls -1`; do du -hs $i; done;



I don't understand your last line. How is it different to "for i in *; blah"? Or even just "du -hs ."?


It was just an example...

instead of "ls -1" you could use any other command that returns a list

The "du -hs ." will only return the size of the current directory, but that was also an example. You could use any other command that you wanted to perform over each item in the list returned by the first command.

Not sure if this is clear enough, please let me know.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: