xargs

shell prompt image

running a command against every line in a textfile

So, you have a text file like so: file1 file2 .. And you want to run a command on each line of the file (say, chmod 644). Like all things UNIX, there are more than one way to do thing, but here’s the quick and dirty answer: xargs -0 -n 1 chmod 644 < <(tr \\n \\0 <filelist.txt)   So, this will run xargs on the std. input (filelist.txt). -n is max arguments – in…


tar.gz icon

How to tar (compress) files up, excluding certain files or directories

If you’ve ever been making a backup of an entire Linux system, or maybe just a number of folders but there were certain folders or files that you didn’t want to have in the backup or zip file, then Look no further than this Quick Tip! First, change to the folder you want to zip, or back up and make sure you have permissions to access all of the files within the folder. For example,…