{"id":8236,"date":"2019-11-14T12:03:14","date_gmt":"2019-11-14T17:03:14","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8236"},"modified":"2021-12-08T10:42:13","modified_gmt":"2021-12-08T15:42:13","slug":"command-line-history","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/command-line-history\/","title":{"rendered":"How to Clear Bash Command Line History in Linux"},"content":{"rendered":"\n
There is a bash or Unix shell history that logs all the commands that the user runs. These records are the basis of the command line history that can be accessed by scrolling back and forth through those records by using the “up arrow<\/strong>” or “down arrow<\/strong>” keys.<\/p>\n\n\n\n For very good reasons, it is possible to clear the entire command line history or delete selected entries.<\/p>\n\n\n\n The primary reason for clearing the contents of the Bash history is security. One good example is where you pass a password as a parameter when running a command like:<\/p>\n\n\n\n Using sshpass<\/strong> to set the password when copying files using SCP<\/strong> for example:<\/p>\n\n\n\n This example is used to copy a file using curl.<\/p>\n\n\n\n$ sshpass -p "password" scp -r user@example.com:\/the\/remote\/path \/the\/local\/path<\/code><\/pre>\n\n\n\n
$ curl --insecure --user username:password -T \/the\/sourcefile sftp:\/\/example.com\/path\/<\/code><\/pre>\n\n\n\n