Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一种快速的方法来打开目录中最后修改的文件,可能是以别名的形式。
目前,我做 ls -ltr。然后复制粘贴文件名
假设我正在使用 tcsh
vi `ls -tr | tail -1`
为提到的答案创建别名将避免每次都输入命令。
在文件中添加以下条目.tcshrc并重新加载。
.tcshrc
alias v='vi `ls -tr | tail -1`'
为避免进入日志文件夹并执行命令,请在下面创建别名并重新加载。
alias -- -='cd -' alias v='cd /path/to/log/folder; vi `ls -tr | tail -1` ; -'