Essential Terminal Commands for Streamlining Workflows

Whether you’re a developer, system administrator, or someone who frequently interacts with the terminal, having a set of powerful and efficient commands at your fingertips can make your tasks smoother and more manageable. In this article, we’ll explore a collection of essential terminal commands that can help you optimize your workflow, from managing processes to handling files and more.

Streamlining Processes

Streamlining processes is a cornerstone of productivity. Master these commands to manage and optimize your tasks:

Background Execution:

Launch a process in the background and disassociate it from the terminal

nohup script
script &
  • nohup stands for “no hang-up.” It prevents a process from being terminated when the terminal session it was started from is closed or disconnected. It’s often used to run long-running processes that you want to continue running even if you close your terminal.
  • &: The ampersand & is used to run a command in the background. It’s similar to nohup in that it detaches the process from the terminal, but it doesn’t protect the process from terminal hangups. If you close the terminal, the background process might be terminated.
  • Avoid using nohup and & together, as it’s not necessary and might lead to confusion or unexpected behaviour. Choose the appropriate method based on your requirement.
nohup script &  // avoid using both at same time

Capture a process’s output in a log file while running in the background

nohup script > log.txt

Process Insight:

Gain insights into all processes related to an application by running

ps -ef
  • ps: to list the current running process
  • e: Select all processes, regardless of whether they’re associated with a terminal
  • f: Display detailed information about each process.

you can filter the process using grep

ps -ef | grep python

Process Termination:

Efficiently terminate a process using its Process ID (PID)

kill -9 proccessID

Quick Process Kill: Terminate processes associated with a certain keyword using pkill keyword

pkill chromeDriver

Efficient File Handling

Files are your building blocks. Master these commands to manipulate and organize files seamlessly:

Compression and Archiving:

tar -cvzf compressed_file.tar.gz original_file

Decompression

tar -xf compresses_file

Disk Utilization Mastery

Understanding disk space is essential. Monitor your storage efficiently with

Disk Space

df -h
  • -h flag is used to display the sizes in a human-readable format (e.g., with units like “GB” and “MB”).

Directory: Check the size of a specific directory and its subdirectories

du -sh directory_path

Size Breakdown: Get a size breakdown of top-level files and directories

du -ah --max-depth=1 -x

Conclusion

Mastering these essential terminal commands empowers you to execute tasks with precision, effortlessly navigate your system, and optimize your workflow. As you integrate these commands into your daily routine, you’ll be amazed at the transformation in your productivity and the newfound sense of control over your terminal environment.

Your journey doesn’t end here; it’s just the beginning. Keep exploring and experimenting with these commands. Embrace the terminal’s potential to transform your work into a seamless and productive experience.

Looking for more ways to enhance your terminal productivity? Check out our article on “Boosting Your Terminal Productivity“.

1 thought on “Essential Terminal Commands for Streamlining Workflows”

Leave a Comment