This prompts history to search for the last command that matches the pattern you provided (in this case, that pattern is dnf) and run it. I could also access that command by entering: $ !sudo dnf The !3 command at the prompt tells the shell to rerun the command on line 3 of the history list. The joy of history is that now you can replay any of them by using a command such as: $ !3 The history command shows a list of the commands entered since you started the session. To see history in action, open a terminal program on your Linux installation and type: $ history However, most of the basic functions are the same. This article is based upon the Bash implementation of history, so some functions may not work in other shells. Because it's written into the shell you're using, there can be some variation in how history behaves depending on whether you're using Bash, tcsh, Zsh, dash, fish, ksh, and so on. Your computer can't find the history command because it's a built-in keyword of your shell. Which: no history in (/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin) You can see this for yourself by looking for the command on your system: $ which history If you are an experienced terminal user, you know about the power of history, but for us dabblers or new sysadmin folks, history is an immediate productivity gain.įirst of all, the history command isn't actually a command. The GNU history command keeps a list of all the other commands that have been run from that terminal session, then allows you to replay or reuse those commands instead of retyping them. The GNU history command is one that really changed my work day. As I spend more and more time in terminal sessions, it feels like I'm continually finding new commands that make my daily tasks more efficient.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |