Table of Contents
为您推荐一些与本文相关的文章:
Home System Tutorial LINUX Is zsh the best shell choice?

Is zsh the best shell choice?

Jan 01, 2024 pm 07:41 PM
linux linux tutorial Red Hat linux system linux command linux certification red hat linux linux video

导读 它相对与 bash,tcsh 等有什么优势呢?如果优势很突出的话可以直接只学 zsh 吗?本篇文章来做一个详细的介绍,从补全、kill、别名、跳转、历史纪录和通配符搜索等方面来详细说明,相信读完之后你会有所收获的。
补全

zsh 的命令补全功能非常强大,可以补齐路径,补齐命令,补齐参数等。(请问你记住 tar 的所有参数了吗 ,只要 tar -加 tab 键,再也不用 rtfm 了 )

zsh 是 shell 中的极品?

按下 tab 键显示出所有待选项后,再按一次 tab 键,即进入选择模式,进入选择模式后,按 tab 切向下一个选项,按 shift+tab 键切向上一个选项,ctrl+f/b/n/p 可以向前后左右切换。
zsh 是 shell 中的极品?

kill

以前杀进程是ps aux | grep xxx查进程的 PID,然后kill PID。有了 zsh,直接kill xxx然后按下 tab 键即可~

别名

zsh 不仅支持普通 alias,还支持针对文件类型的 alias。我配置的文件类型 alias 如下:

alias -sgz='tar -xzvf'
alias -stgz='tar -xzvf'
alias -szip='unzip'
alias -sbz2='tar -xjvf'
alias -sphp=vi
alias -spy=vi
alias -srb=vi
alias -shtml=vi
aliasgcid=<span class="s2">"git log | head -1 | awk '{print substr(\$2,1,7)}' | pbcopy"
</span>

配置完毕之后,在 zsh 下直接输入xxx.rb,将自动用 vi 打开,直接输入xxx.tgz,将直接按照tar -xzvf解压。最后一个gcid将当前 git 项目的第一个 commit 的 id 复制到系统剪切板,在执行 rebase 的时候特别方便。

跳转

zsh 的目录跳转更为智能,你无需输入cd,直接输入路径即可。..表示后退一级目录,../../表示后退两级,依次类推。(...的作用和../../相同)

输入d,将列出当前 session 访问过的所有目录,再按提示的数字即可进入相应目录。

~/Applications
~/.proxychains
~/opt/homebrew-cask/Caskro
~/Applications
历史记录

zsh 的历史记录跨 session,可以共享。历史记录支持受限查找。比如,输入git,再按向上箭头,会搜索用过的所有 git 命令。

通配符搜索

ls *.png查找当前目录下所有 png 文件,ls **/*.png递归查找。

本文原创地址:https://www.linuxprobe.com/zsh-shell.html ‎作者:王毅,审核员:逄增宝

本文原创地址:https://www.linuxprobe.com/zsh-shell.html编辑:王毅,审核员:暂无

为您推荐一些与本文相关的文章:

  • 《C语言设计基础教程》pdf电子书免费下载
  • OpenRASP自我保护方案
  • Thunderbird – 开源免费跨平台邮箱客户端
  • 《SAP Web Dynpro for ABAP开发技术详解 基础应用》pdf电子书免费下载
  • 网络安全抗攻击力说明
  • 打造你的U盘版Linux系统
  • 基于Debian 9.9的Emmabuntüs DE2-1.04 发布
  • 云计算供应商挑选
  • 关于Linux操作系统的一些小知识点总结
  • 《JavaScript for PHP Developers》pdf电子书免费下载

The above is the detailed content of Is zsh the best shell choice?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1587
276
How to make PHP container support automatic construction? Continuously integrated CI configuration method of PHP environment How to make PHP container support automatic construction? Continuously integrated CI configuration method of PHP environment Jul 25, 2025 pm 08:54 PM

To enable PHP containers to support automatic construction, the core lies in configuring the continuous integration (CI) process. 1. Use Dockerfile to define the PHP environment, including basic image, extension installation, dependency management and permission settings; 2. Configure CI/CD tools such as GitLabCI, and define the build, test and deployment stages through the .gitlab-ci.yml file to achieve automatic construction, testing and deployment; 3. Integrate test frameworks such as PHPUnit to ensure that tests are automatically run after code changes; 4. Use automated deployment strategies such as Kubernetes to define deployment configuration through the deployment.yaml file; 5. Optimize Dockerfile and adopt multi-stage construction

How to build an independent PHP task container environment. How to configure the container for running PHP timed scripts How to build an independent PHP task container environment. How to configure the container for running PHP timed scripts Jul 25, 2025 pm 07:27 PM

Building an independent PHP task container environment can be implemented through Docker. The specific steps are as follows: 1. Install Docker and DockerCompose as the basis; 2. Create an independent directory to store Dockerfile and crontab files; 3. Write Dockerfile to define the PHPCLI environment and install cron and necessary extensions; 4. Write a crontab file to define timing tasks; 5. Write a docker-compose.yml mount script directory and configure environment variables; 6. Start the container and verify the log. Compared with performing timing tasks in web containers, independent containers have the advantages of resource isolation, pure environment, strong stability, and easy expansion. To ensure logging and error capture

How to Securely Erase a Hard Drive on Linux How to Securely Erase a Hard Drive on Linux Jul 24, 2025 am 12:08 AM

Confirm the target hard disk device name (such as /dev/sda) to avoid accidentally deleting the system disk; 2. Use sudoddif=/dev/zeroof=/dev/sdXbs=1Mstatus=progress to overwrite the zero value in full disk, which is suitable for most scenarios; 3. Use sudoshred-v-n3/dev/sdX for three random data overwrites to ensure that it cannot be restored; 4. Optionally execute sudobadblocks-wsv/dev/sdX for destructive write tests; finally use sudohexdump-C/dev/sdX|head to verify whether it is all zero and complete safe erasing.

Linux vs Windows: Which Operating System is Better for You? Linux vs Windows: Which Operating System is Better for You? Jul 29, 2025 am 03:40 AM

Windowsisbetterforbeginnersduetoeaseofuse,seamlesshardwarecompatibility,andsupportformainstreamsoftwarelikeMicrosoftOfficeandAdobeapps.2.LinuxoutperformsWindowsonolderorlow-resourcehardwarewithfasterboottimes,lowersystemrequirements,andlessbloat.3.Li

How to Schedule Tasks on Linux with Cron and anacron How to Schedule Tasks on Linux with Cron and anacron Aug 01, 2025 am 06:11 AM

cronisusedforpreciseschedulingonalways-onsystems,whileanacronensuresperiodictasksrunonsystemsthataren'tcontinuouslypowered,suchaslaptops;1.Usecronforexacttiming(e.g.,3AMdaily)viacrontab-ewithsyntaxMINHOURDOMMONDOWCOMMAND;2.Useanacronfordaily,weekly,o

What to do after installing linux What to do after installing linux Jul 23, 2025 am 02:57 AM

AfterinstallingLinux,thefirststepsincludeupdatingyoursystem,installingessentialsoftware,settingupbackupandsecuritymeasures,andcustomizingtheinterfacetosuityourpreferences.1)Updateyoursystemusingtheappropriatecommandforyourdistro(e.g.,sudoaptupdate&am

How to install software on Linux using the terminal? How to install software on Linux using the terminal? Aug 02, 2025 pm 12:58 PM

There are three main ways to install software on Linux: 1. Use a package manager, such as apt, dnf or pacman, and then execute the install command after updating the source, such as sudoaptininstallcurl; 2. For .deb or .rpm files, use dpkg or rpm commands to install, and repair dependencies when needed; 3. Use snap or flatpak to install applications across platforms, such as sudosnapinstall software name, which is suitable for users who are pursuing version updates. It is recommended to use the system's own package manager for better compatibility and performance.

The Ultimate Guide to High-Performance Gaming on Linux The Ultimate Guide to High-Performance Gaming on Linux Aug 03, 2025 am 05:51 AM

ChoosePop!_OS,Ubuntu,NobaraLinux,orArchLinuxforoptimalgamingperformancewithminimaloverhead.2.InstallofficialNVIDIAproprietarydriversforNVIDIAGPUs,ensureup-to-dateMesaandkernelversionsforAMDandIntelGPUs.3.EnabletheperformanceCPUgovernor,usealow-latenc

See all articles