history

让history记录命令的历史执行时间

◇◆丶佛笑我妖孽 提交于 2021-01-29 06:19:37
让 history 记录命令的历史执行时间 由于 Linux 默认的 history 记录仅保存了命令的内容, [root @oracle ~]# history 1 date -s "2013-1-22 9:48:30' 2 " 3 date -s "2013-1-22 9:48:30" 4 clock -w 5 clear 6 ntpdate 10.20.0.11 7 setup 8 service iptabels stop 没有具体的时间,我只能通过查出用户的登录与退出的时间,来给他们一个时间范围。 因此,我们非常有必要对 history 历史命令的记录功能进行优化,我推荐的参数如下: 编辑 /etc/bashrc , 添加以下配置信息: # 设置保存历史命令的文件大小 export HISTFILESIZE=1000000000 # 保存历史命令条数 export HISTSIZE=1000000 # 实时记录历史命令,默认只有在用户退出之后才会统一记录,很容易造成多个用户间的相互覆盖。 export PROMPT_COMMAND="history -a" # 记录每条历史命令的执行时间 export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S " 使更改立即生效: # source /etc/bashrc 查看历史命令记录: # history

history.push is changing url but not rendering component in react

拥有回忆 提交于 2021-01-28 21:26:14
问题 I am facing a problem with react history.push . The logic of my code is, when the API call completes, if the login status in response is false, I want to push to another route. The URL is changing but the component is not rendering until I refresh the page. Here is my code for changing the route useEffect(() => { const getProductsData = async () => { setIsLoading(true); const productsData = await fetchProductsApi(); setIsLogin(productsData.data.login); setProductsArray(productsData.data.data)

Why can't I delete multiple entries from bash history with this loop

若如初见. 提交于 2020-07-08 20:50:33
问题 This loop will display what I want to do but if I remove the echo from it, it won't actually delete anything: history | grep ":[0-5][0-9] ls *$" | cut -c1-5 | while read id; do echo history -d $id done I've added indentation in order to make it more readable but I am running it as a one-liner from the command line. I have HISTTIMEFORMAT set so the grep finds the seconds followed by ls followed by an arbitrary number of spaces. Essentially, it's finding anything in history that's just an ls .

Why can't I delete multiple entries from bash history with this loop

瘦欲@ 提交于 2020-07-08 20:49:08
问题 This loop will display what I want to do but if I remove the echo from it, it won't actually delete anything: history | grep ":[0-5][0-9] ls *$" | cut -c1-5 | while read id; do echo history -d $id done I've added indentation in order to make it more readable but I am running it as a one-liner from the command line. I have HISTTIMEFORMAT set so the grep finds the seconds followed by ls followed by an arbitrary number of spaces. Essentially, it's finding anything in history that's just an ls .

Searching your command history on macOS terminal

落花浮王杯 提交于 2020-06-24 03:22:11
问题 What is the shortcut to search my command history in macOS terminal? For how long is the history available for searching? Where is it stored? 回答1: How about using Ctrl + R for searching on the Terminal Utility in Mac for searching on the command history, dudeOnMac: freddy$ whoami freddy (reverse-i-search)`who': whoami Well for controlling how long the history would be retained that depends on a few shell environment variables, HISTFILESIZE which is nothing but number of lines of history you