Skip to content

Instantly share code, notes, and snippets.

@willingc
Last active September 5, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willingc/247b4d1837e1e9c2ae7152801d3b2a67 to your computer and use it in GitHub Desktop.
Save willingc/247b4d1837e1e9c2ae7152801d3b2a67 to your computer and use it in GitHub Desktop.
Bash Commands

Use the following syntax to enter Bash commands.

One-Line Command

! is used to execute a one-line command.

For example, use the following to list all files:

! ls -a

Multi-line Commands

%%bash is a notebook magic used to execute multi-line commands. After this magic, add a new blank line, and then one command per line after that.

For example, use this snippet to change the directory and list all files:

%%bash

cd data
ls -al

Frequently Used Commands

Task Command
Change Directory cd <directory_name>
Make a New Directory mkdir <directory_name>
Output Current Directory pwd
List files ls
List with hidden files ls -a
List with details ls -l
List with details and hidden files ls -al
Copy a file cp <source_file> <destination>
Move a file mv <source_file> <destination>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment