New answers tagged

1

I also couldn't get xargs -P working when I needed to do something similar, and I ended up using &. From man bash: If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0. These are referred to as asynchronous ...


0

You can remove files from the home directories with the following command : find /home/*/ -mtime +15 -type f -delete And easily put it in a cron to do it automatically.


1

Now based on your recent comment I can say that most likely it just run our of inodes. When you create ext4 fs by default mkfs allocates inodes based on partition/image size. So the less is the image size, the less is the inode count. You edit this script to allocate more inodes, just find a line where it does mkfs.ext4 and change the number of inode it ...


2

Use the zip command line switch -@ to have zip take the list of input files from standard input instead of from the command line. For example, grep -ril "test string" | zip name-of-new-zip-file -@


0

You can try the command on this way: zip zipfile.zip `grep -ril "test string"`


2

You should use wait_for_connection instead. tasks: - name: Execute the script shell: bash testscript.sh args: chdir: /home/ubuntu - name: wait wait_for_connection: delay: 10 I'd advise to do this in a task, not a handler. The handler is only executed after all tasks have been finished, so if you have tasks following the task ...


1

I prefer to create the folder before the loop if it's the same (optimisations are everywhere :D ) So, I have the following (tested on Ubuntu 18.04) : mkdir -p <destination_folder> for i in $(find <source_folder> -name '<pattern>') do mv $i <destination_folder> done


0

If you log out (Ctrl-D or exit), it will continue to run. But if you close the terminal window, the background processes will receive SIGHUP. They will also receive SIGHUP is you lose a connection to a server. The same goes for a shell running locally (except that you can't lose a connection to a local shell).


0

If possible to suggest a fix to the recipients, there's a setting in Outlook: For Outlook 2010 and later versions: Open Outlook. On the File tab, select Options. In the Options dialog, select Mail. In the Message format section, clear the Remove extra line breaks in plain text messages check box. Select OK. For Outlook 2007 or earlier versions: Open ...


1

Somewhere on the internet I had found this solution some time ago: sqlite3 $database <<EOF ATTACH DATABASE "${example_db}" AS ref; YOUR MULTILINE SQLITE STATEMENT; CREATE TEMPORARY TABLE...; TEMPORARY TABLE STILL THERE; EOF Not sure what happens when you do multiple SELECT statements.


0

This worked for me: systemctl [--user] show [unit name] --property=NeedDaemonReload or systemctl [--user] show [unit name] | grep NeedDaemonReload= It will output "NeedDaemonReload=yes" if it need to be reloaded. If you use the grep method you can change the last part to grep NeedDaemonReload=yes or grep NeedDaemonReload=no to make it output ...


1

There are many solutions here but many involve using an interpreted language. @sk8asd123 's answer seems ince. Here is another one: find . -iname "*ENDING" | sed 's/\(.*\/\)\(.*\)/\1/' | sort -u It is kind of dirty and has different logic than the question: First find the files (any expression find can understand), remove the file names (part ...


0

In my case, I used $PWD. However, when you run the command ln -s $PWD/myscript /usr/local/bin/myscript then you receive the error message "error: target is not a directory" if your current path contains a space. The solution is to use quotes: ln -s "$PWD/myscript" /usr/local/bin/myscript


0

The command sudo systemctl start setpermissions.service starts the service immediately in the current session. To enable a service at boot, you need to run the following command: sudo systemctl enable setpermissions.service You can also enable and start the service in one command: sudo systemctl enable --now setpermissions.service


Top 50 recent answers are included