File Command Shortcuts for Windows, Mac & Linux
- Average speed
- km/h
- Result
- Finish time
- 50 min
- You entered
- Distance
- 10 km
- You entered
File command shortcuts let you copy, move, delete, rename, and list files without reaching for the mouse. This article covers the most useful terminal shortcuts for Windows (Command Prompt and PowerShell), macOS, and Linux, plus how to combine them for real work.
Why Learn File Shortcuts?
Typing commands is faster than clicking through windows when you need to perform the same operation on many files, or when you work over a remote server. Shortcuts also let you script repetitive tasks—rename dozens of photos, move logs to an archive folder, or delete temp files—with a single line. Even a handful of commands can save hours each week.
Each operating system has its own set of commands, but the concepts are similar. Once you learn one, the others are easy to pick up.
Windows: Command Prompt (cmd)
Command Prompt is the classic Windows terminal. It uses commands like copy, move, del, and ren. Here are the most useful ones:
dir– list files and folders in the current directory. Add/sto include subdirectories,/bfor bare format (names only).cd– change directory.cd ..goes up one level,cd \goes to the drive root.copy source dest– copy a file. Use*.txtto copy all text files.move source dest– move or rename a file.del file– delete a file. Use with caution; it doesn’t go to the Recycle Bin.ren oldname newname– rename a file or folder.mkdir– create a new folder.
Shortcuts: press Tab to auto-complete file names, F7 to see command history, and Ctrl+C to cancel a running command.
Windows: PowerShell
PowerShell is the modern Windows shell, with more power and consistency. Its file commands are aliases for Get-ChildItem, Copy-Item, etc. The common ones:
lsordir– list files (alias forGet-ChildItem).cp– copy (alias forCopy-Item).mv– move or rename (alias forMove-Item).rm– delete (alias forRemove-Item).cat– display file contents (alias forGet-Content).
PowerShell supports wildcards like * and ?, and you can use -Recurse to act on subfolders. For example, cp *.jpg -Destination backup copies all JPGs to the backup folder.
macOS and Linux: Bash / Zsh
Both macOS and Linux use similar Unix-like commands. The most common:
ls– list files.ls -lfor details,ls -ato show hidden files.cd– change directory.cp source dest– copy. Add-rto copy folders recursively.mv source dest– move or rename.rm file– delete. Add-rfor folders,-fto force (no confirmation). Be very careful.mkdir– create folder.touch– create an empty file or update timestamp.
Shortcuts: Tab auto-completes, Ctrl+R searches history, Ctrl+U clears the line, Ctrl+W deletes the word before the cursor.
Combining Commands with Wildcards and Pipes
Wildcards let you act on many files at once. * matches any number of characters, ? matches one. Examples:
cp *.log backup/– copy all .log files.rm report-2023-*.txt– delete all matching files.mv photo?.jpg archive/– move files like photo1.jpg, photo2.jpg.
Pipes (|) send the output of one command into another. For instance, ls | grep pdf lists only files with “pdf� in the name. On Windows PowerShell, you can use ls | Select-String pdf.
Common Mistakes and Safety Tips
The biggest risk with file commands is deleting the wrong thing. Here are the most common mistakes:
- Using
rmwithout checking –rm -rfdeletes everything in a folder, including subfolders, with no confirmation. Always double-check the path. - Mixing up source and destination –
cp source destis the order. Reversing them can overwrite files. - Spaces in file names – Always quote names with spaces:
cp "My File.txt" backup/. - Overwriting files – Many commands overwrite silently. Use
-i(interactive) on Linux/macOS to ask before overwriting.
Safety tip: before deleting, use ls to see what matches your pattern. And consider using mv to a trash folder instead of deleting immediately.
Frequently Asked Questions
How do I undo a file command?
There is no general undo in the terminal. Once you delete or overwrite, it’s gone. Some editors keep backups, but the shell does not. Always double-check before running destructive commands, and consider using version control for important files.
What’s the difference between cp and mv?
cp copies a file, leaving the original in place. mv moves it, so the original is gone. mv is also used to rename files, since renaming is just moving to a new name in the same folder.
Why does rm not work on a folder?
On Unix-like systems, rm only deletes files. To delete a folder and its contents, you need rm -r (recursive). On Windows, del deletes files, and rmdir removes empty folders.
How do I see hidden files?
On Linux/macOS, use ls -a. On Windows Command Prompt, use dir /a to show all files including hidden ones. In PowerShell, ls -Force shows hidden items.
Can I use these commands on a remote server?
Yes, if you connect via SSH (Secure Shell) on Linux/macOS or use PowerShell Remoting on Windows. The commands work the same way as they do locally.
What does sudo do and when do I need it?
sudo runs a command with administrator privileges. You need it when a file is owned by root or another user and you lack permission. Use it sparingly, as it can damage system files if misused.
Related
Formula used
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.