终端备忘单🔥 - 最有用的终端命令🚀

2025-05-28

终端备忘单🔥 - 最有用的终端命令🚀

Hello world!以下是您应该熟记的基本终端命令的列表。

🔖 - 为文章添加书签以保存备忘单

记得点赞 ❤️ 或许还有🦄

替代文本

你绝对需要读一下:

基础知识

我喜欢 git bash(我在 Windows 上) - 版本 4.4.23

Git Bash 在 Windows 上模拟了 Bash 环境。它允许你在命令行中使用所有 git 功能以及大多数标准 Unix 命令。

  • 要记住的 3 个基本命令:
Clear: type "clear" / ctrl + l (windows - Linux) / Command + K (Mac)
help - show all comands
help commandName - help about a specific command
ctrl+D or ctrl+C * 2 to exit 
Enter fullscreen mode Exit fullscreen mode

使用目录:

ls - list / list the contents on your current directory
ls -la - Give more information about the list 
pwd - Print Working directory / Print the path to the working directory
cd directory - Change directory / Move between folders - Relative Path (just folders directly contained in the one you are currently)
cd /firstDirectory/secondDirectory/FinalDirectory - Absolute Path (search a directory anywhere in pc)
cd .. - Go back a directory
cd ~ - return to the home directory
mkdir - make directory / create a new directory+
mkdir -v - Make directory + add lines that say you created a directory
touch - Create a file (or multiple) or "touch", change a file (update when it was last modified)
rm - Remove / Delete a File (forever)
rm -rf - Remove recursive force / Delete a directory add all file nested in the directory (also other directories)
rmdir - remove a directory (only work on empty folders)
Enter fullscreen mode Exit fullscreen mode

更易读的方式:

图像


基本命令:

写入:help访问

图像

Git可用命令:

图像

写入:git --help访问


图像

写入:git help -g访问


附加功能:以更易读的方式编写git help git命令行,将您重定向到包含所有 git bash 可用命令的下载

输入git help -a以访问更高级的逐行命令描述 - 输入 q 退出


希望这有帮助!

记得点赞 ❤️ 或许还有🦄


您补充道:

# opens .zprofile for editing (zsh profile)
alias prof='nano /<<ROOTDIRECTORYHERE>>/.zprofile' 
# opens .zshrc for editing
alias rc='nano /<<ROOTDIRECTORYHERE>>/.zshrc' 
# source profiles (should be done every time after changing profile)
alias s='source /<<ROOTDIRECTORYHERE>>/.zprofile; source /<<ROOTDIRECTORYHERE>>/.zshrc;'
# fancy ls
alias lk='ls -lhkart'
# for 'lk' typos ;)
alias kl='ls -lhkart' 
# open current folder in GUI
alias show='open .'
# go back a folder
alias back='cd ..'
# previous folder
alias prev='cd -'
# cd with no arguments brings you to your root folder :)
alias home='cd'
Enter fullscreen mode Exit fullscreen mode

cd (without args)- 返回主目录

pushd and popd.

pushd 命令将当前工作目录保存在内存中,以便随时返回。pushd 命令会移动到父目录。popd 命令会返回目录堆栈顶部的路径。[5][6] 此目录堆栈可通过 Unix 系统中的 dirs 命令或 Windows PowerShell 中的 Get-Location -stack 命令访问。
了解更多

其他文章:

推荐阅读!


订阅我的新闻通讯!

为您带来冗长而有趣的每周回顾
我的文章的免费 PDF 版本
高度可定制的收件箱
那是 --> 免费 <-- 而且您可以帮助我!

文章来源:https://dev.to/worldindev/the-most-useful-terminal-commands-how-to-work-with-directories-51l8
PREV
终极 Cheat Sheets 合集(200+)-🔥🎁 / 开发路线图🚀
NEXT
ES6 速查表 🔥 - 你所需要的一切🚀