Question: How do I kill all the jobs running in the background in Linux command line? Answer: If you want to kill all the background jobs in Linux, you can use this: jobs -p | xargs kill Explanation: Here’s the quick explanation of the above command: jobs: the command to display all the jobs started in… Read More
You’ll often find yourself in situations where you need to empty a file. So, how do you empty a file in Linux? How to clear a file from all of its content without deleting the actual file? There are several ways you can delete all the content of a file without actually deleting the file.… Read More
You may find yourself in a situation when you wonder “how do I change permission for a folder and all of its subfolders and files in Linux”? The answer is really simple. Similar to recursively creating directory structure, you can use the inbuilt option in the chmod command. I believe you already know that you can… Read More
A quick tip that shows how to bring a background job back to the foreground in Linux command line.
Problem scenario: You want to create a nested directory structure like dir1/dir2/dir3. But none of these directories exists. So, you will encounter an error like this: mkdir dir1/dir2/dir3 mkdir: cannot create directory ‘dir1/dir2/dir3′: No such file or directory This is because, by default, mkdir command cannot make nested directories if the parent directory doesn’t exist.… Read More
How to find all the files that have been created or modified in last few hours? You may find yourself in a situation when you need to find some files like log files. You know that there are files that have been modified or created recently. You also know that those files are somewhere in… Read More