[Bash] Rerun Bash Commands with History Expansions (!! & !$)
amp with Bash history commands
2023-09-14 09:00:46 时间
!! & !&
History expansions let you interact with bash's history. For example, if you forgot to run a command with sudo, you can sudo !! to rerun the last command with it. !$ can be used to access the last argument of the last command.
Rerun last command
date
## print the date
!!
## print the date again
It is useful when you forgot to add sudo
ifconfig en0 down
## error because of sudo
sudo !!
Last argument of previous command
touch script.js
## last argument is 'script.js'
chmod +x !$
## the same as chmod +x script.js
相关文章
- HEVC代码追踪(九):帧间->xCheckRDCostInter
- HTML中      等6种空白空格的区别
- 特征组合&特征交叉
- [AWS Amplify] Create & Interact with an AWS AppSync GraphQL API with AWS Amplify
- [NestJS] Basic CRUD with Mongoose & NestJS
- [React Native] Up & Running with React Native & TypeScript
- [Vue @Component] Pass Props Between Components with Vue Slot Scope & renderless component
- [CSS3] Image Width with sizes (srcset & sizes)
- [AngularJS] ng-ture-value & ng-false-value
- [Node & Testing] Intergration Testing with Node Express
- [Angular 2] @Input & @Output Event with ref
- [Angular 2] 9. Replace ng-modle with #ref & events
- [Node.js] npm init && npm install
- Eclipse & Visual Studio
- 【HIBERNATE框架开发之七】HIBERNATE使用ANNOTATION中各种关系映射的CRUD(增删改查)&&集合映射&&继承映射
- [Typescript] Get full type safe for discriminatedUnion type with 'type' & 'subtype' (2 levels)
- [Vue @Component] Pass Props Between Components with Vue Slot Scope & renderless component
- [Angular 2] Generate Angular 2 Components Programmatically with entryComponents & ViewContainerRef
- [React Native + Firebase] React Native: Real time database with Firebase -- setup & CRUD
- Windows下OpencvSharp编译CUDA 一、基本知识入门&信心满满
- VMware 打开虚拟机电源时提示"内部错误"
- 华为OD机试 - 数字字符串组合倒序(Java & JS & Python)
- AI&BlockChain:“知名博主独家讲授”人工智能创新应用竞赛【精选实战作品】之《基于计算机视觉、自然语言处理、区块链和爬虫技术的智能会议系统》软件系统案例的界面简介、功能介绍分享之一、会前智能
- 成功解决Command "python setup.py egg_info" failed with error code 1 in C:UsersAppData
- org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {解决方法
- 【大数据&AI人工智能】图灵:计算机器与智能 - 经典AI论文系列
- How to solve the problem : "You have been logged on with a temporary profile"
- Codeforces 427 D. Match & Catch
- Chapter2 ROS通信机制----基础篇(Ⅲ)&ROS常用命令及实操训练
- [Git & GitHub] VS2015 上配置使用Git