Command line tricks
Some command line tricks for Linux.
Passing arguments to a command from a text file
For example, to install two lists of packages in Ubuntu:
xargstakes the output from
sedas arguments to
sed 's/#.*$//'filters out those lines after
#. So the
list2.txtcan have comments like the following
Passing multiple lines of string
Using heredoc to pass the string between two delimiters (e.g.
Will append the following lines in
nohup: Do not hang up in SSH sessions
nohup to run background process(es) uninterruptedly even when going offline in a remote SSH session.
The output will be in
nohup.out by default. If you want to customize the output location, just redirect it:
You can also lower the priority for the background process
When you’re done, you can kill the process by the proccess ID (PID)