DEV Community

Mwenda Harun Mbaabu
Mwenda Harun Mbaabu

Posted on

Mastering Terminal Commands and Jupyter Notebook Shortcuts: Your Complete Handbook

Most developers, relies on graphical user interfaces (GUIs) for their computing needs. GUIs offer a user-friendly way to interact with machines.
However, it's worth noting that there exists a highly capable alternative: the command-line interface (CLI). By issuing text-based commands, a CLI empowers users with greater control and flexibility over their computers, providing a powerful means of interaction.

In this article, we will delve into the world of common terminal commands that can significantly enhance your efficiency and productivity, whether you're an engineer or a data scientist. These commands are key to unlocking the full potential of your computer.

Common Terminal Commands:

1. Navigating the File System:

  • ls: List files and directories in the current directory.
ls 
Enter fullscreen mode Exit fullscreen mode
  • cd : Change directory.
cd Documents
Enter fullscreen mode Exit fullscreen mode
  • pwd: Print the current working directory.
pwd
Enter fullscreen mode Exit fullscreen mode
  • mkdir : Create a new directory.
mkdir mynewapp
Enter fullscreen mode Exit fullscreen mode
  • rm : Remove a file or directory.
rm file.txt
Enter fullscreen mode Exit fullscreen mode
  • cp : Copy files or directories.
cp file.txt /backup/

Enter fullscreen mode Exit fullscreen mode
  • mv : Move or rename files or directories.
mv file.txt newfile.txt
Enter fullscreen mode Exit fullscreen mode

2). Managing Files:

  • touch : Create a new empty file.
touch newfile.txt
Enter fullscreen mode Exit fullscreen mode

cat : Display the contents of a file.

cat file.txt
Enter fullscreen mode Exit fullscreen mode
  • nano or vim : Open a text editor to edit a file.
nano file.txt
Enter fullscreen mode Exit fullscreen mode
  • head : Display the first few lines of a file.
head file.txt 
Enter fullscreen mode Exit fullscreen mode
  • tail : Display the last few lines of a file.
tail file.txt
Enter fullscreen mode Exit fullscreen mode

3). Searching and Finding:

  • grep : Search for a pattern in a file.
grep "pattern" file.txt
Enter fullscreen mode Exit fullscreen mode
  • find -name : Find files by name in a directory.
find /path/to/directory -name "file.txt"
Enter fullscreen mode Exit fullscreen mode

4). System Information:

  • top: Display a dynamic view of system processes.
top
Enter fullscreen mode Exit fullscreen mode
  • df -h: Show disk space usage.
df -h
Enter fullscreen mode Exit fullscreen mode
  • free -h: Display free and used memory.
free -h
Enter fullscreen mode Exit fullscreen mode

5). Package Management (Linux):

  • apt-get install : Install a package (Debian/Ubuntu).
sudo apt-get install package-name
Enter fullscreen mode Exit fullscreen mode
  • yum install : Install a package (Red Hat/CentOS).
sudo yum install package-name
Enter fullscreen mode Exit fullscreen mode

6). Network and Connectivity:

  • ping : Send ICMP echo requests to a host.
ping google.com
Enter fullscreen mode Exit fullscreen mode

ifconfig or ip addr: Show network interface information.

ifconfig
Enter fullscreen mode Exit fullscreen mode
  • ssh @: Connect to a remote server using SSH.
ssh username@hostname
Enter fullscreen mode Exit fullscreen mode

Anaconda Jupyter Notebook Shortcut Keys:

1. Command Mode Shortcuts (Press Esc to enter command mode):

  • A: Insert a new cell above the current cell.
  • B: Insert a new cell below the current cell.
  • D, D (Press D twice): Delete the current cell.
  • M: Change the cell type to Markdown.
  • Y: Change the cell type to Code.
  • Shift + Enter: Run the current cell and move to the next one.
  • Ctrl + Enter: Run the current cell and stay on it.
  • Up Arrow or K: Select the cell above the current cell.
  • Down Arrow or J: Select the cell below the current cell.

2. Edit Mode Shortcuts (Press Enter to enter edit mode):

  • Shift + Tab: Show docstring and function signature help.
  • Tab: Code completion or indentation.
  • Ctrl + /: Comment/uncomment selected lines.
  • Ctrl + Shift + -: Split the current cell at the cursor position.

3. Other Useful Shortcuts:

  • Esc, H: Show keyboard shortcuts help.
  • Esc, I, I (Press I twice): Interrupt the kernel.
  • Esc, 0, 0 (Press 0 twice): Restart the kernel.
  • Esc, L: Toggle line numbers in code cells.
  • Esc, O: Toggle cell output.

In summary, mastering these essential terminal commands and Anaconda Jupyter Notebook shortcuts empowers users, whether engineers or data scientists, with the tools to navigate and efficiently perform a wide array of tasks. By embracing the command-line interface and harnessing the power of these commands, you can significantly enhance your efficiency and productivity, ultimately unlocking the full potential of your computer. Whether you're managing files, searching for information, or monitoring system processes, these skills are invaluable in today's technology-driven world, enabling you to work with greater control and flexibility while making the most of your computing experience.

Top comments (0)