LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-02-2021, 07:31 PM   #1
linux1021
Member
 
Registered: Jun 2016
Location: Washington State, USA
Posts: 78

Rep: Reputation: Disabled
Unhappy kali linux command history -c not working


Hi! Everybody

I have a virtual machine for kali-linux-2021.1 XFCE 4.16 64 bit. I found out that the history -c command to clear history, does not work in this version. Now, I run this command in the regular Debian 10.9 which is the latest version and others and it works just fine. See the attached screenshot for proof, please. Any ideas? Thanks for you time and help in advance. Have a nice day.
Attached Thumbnails
Click image for larger version

Name:	kali linux command history -c not working.png
Views:	702
Size:	140.0 KB
ID:	36014  
 
Old 04-02-2021, 07:55 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696
That command to clear history is a BASH shell command. make sure that you are in the BASH shell, and that the version is one that supports clearing command history that way. (Any current bash shell should, but I do not use KALI and do not know what shell you might be running.)
 
Old 04-02-2021, 07:59 PM   #3
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Your error was
fc: event not found: -c

That tells the user to do:
Code:
man fc
So look into why you're not using the history command that you want to use.
Is it an alias? Try:
Code:
which history
Also, try to figure out a way to
actually post the output, rather than a screen picture, which takes extra time to display. (I made a completely wrong guess about the problem until I took the time to look at the screenshot. From my post time to edit time you can see I missed the whole family feud show)

Last edited by !!!; 04-02-2021 at 08:30 PM.
 
1 members found this post helpful.
Old 04-02-2021, 08:28 PM   #4
linux1021
Member
 
Registered: Jun 2016
Location: Washington State, USA
Posts: 78

Original Poster
Rep: Reputation: Disabled
Unhappy kali linux command history -c not working

Quote:
Originally Posted by !!! View Post
Your error was
fc: event not found: -c

So look into why you're not using the history command that you want to use.
Is it an alias? Try:
Code:
which history
Also, try to figure out a way to
actually post the output, rather than a screen picture, which takes extra time to display. (I made a completely wrong guess about the problem until I took the time to look at the screenshot)
Here is the command output that you wanted. Any ideas? It is not resolved yet. Thanks for your time and help. Have a nice day.

Code:
┌──(maverick㉿TopGun)-[~]
└─$ which history
history: aliased to history 0

Last edited by linux1021; 04-02-2021 at 08:41 PM. Reason: Specifying not resolved yet.
 
Old 04-02-2021, 08:33 PM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Actually, this was the command output you wanted. Thanks for providing the solution.
 
Old 04-02-2021, 08:42 PM   #6
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Quote:
Originally Posted by Emerson View Post
Actually, this was the command output you wanted. Thanks for providing the solution.
I think this says I shouldn't be stumped, but I am!!!

What happened to fc?
Are we looking at two different systems?
Try both commands on both systems (?)

Last edited by !!!; 04-02-2021 at 08:46 PM.
 
Old 04-02-2021, 08:47 PM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Your troubleshooting skills are admirable.
People who are getting help too often even do not look at the output of commands or examine the logs requested. They just dump it here and want someone else to look what's wrong. I resent that.
 
1 members found this post helpful.
Old 04-02-2021, 09:02 PM   #8
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Look up what
pretending a backslash
does to a command.

Code:
\history -c
Also look up how to determine for certain which shell you're using.

I'm still stumped (about: where's fc) but having fun learning, so don't feel bad!!!
 
1 members found this post helpful.
Old 04-02-2021, 09:06 PM   #9
linux1021
Member
 
Registered: Jun 2016
Location: Washington State, USA
Posts: 78

Original Poster
Rep: Reputation: Disabled
Angry

Quote:
Originally Posted by Emerson View Post
Your troubleshooting skills are admirable.
People who are getting help too often even do not look at the output of commands or examine the logs requested. They just dump it here and want someone else to look what's wrong. I resent that.
I indicated that the command still does not work, that is all. According to which history 0 still does not work. Do you have any idea? See below for proof.

Code:
┌──(maverick㉿TopGun)-[~]
└─$ history 0 -c
fc: too many arguments
 
Old 04-02-2021, 09:33 PM   #10
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
zsh is (apparently) the shell you're using!!!

I suspect the gurus are enjoying us being stumped! (Which is generally a result of anyone mentioning kali)

I can't figure out how history is getting turned into fc. Any guesses?

alias | egrep 'hist|fc'
\which which
\alias -a history

I tried setting up the same alias of history to history 0, and which history reports nothing!

But I just discovered the default shell in kali is zsh not bash!!!

Last edited by !!!; 04-02-2021 at 09:48 PM.
 
Old 04-02-2021, 10:34 PM   #11
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
-c is not a valid history option in zsh

https://stackoverflow.com/questions/...my-zsh-history

Quote:
zsh's fc and history don't have any options to delete entries
Please mark this thread as solved.
 
Old 04-02-2021, 10:54 PM   #12
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by !!! View Post
Look up what
pretending a backslash
does to a command.
Your haiku skills are inspiring. I will try as well.

Your aliases
Don't underestimate them
They should be removed
 
1 members found this post helpful.
Old 04-03-2021, 05:14 AM   #13
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Originally Posted by Emerson View Post
Your troubleshooting skills are admirable.
People who are getting help too often even do not look at the output of commands or examine the logs requested. They just dump it here and want someone else to look what's wrong. I resent that.
+1 on that!

@OP: I gather you're expecting everything to work on Kali linux. How strange. Kali linux has one main use - pen testing via ethernet. That works, and the experts who do that don't have everything working. Read this thread https://www.linuxquestions.org/quest...ad-4175614092/ and install an OS where you currently have Kali if you want things to work. Kali is best seen as a tool, not an OS. The only time you should keep it is if you need to learn how to use the tool.
 
Old 04-13-2021, 04:28 PM   #14
linux1021
Member
 
Registered: Jun 2016
Location: Washington State, USA
Posts: 78

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by !!! View Post
-c is not a valid history option in zsh

https://stackoverflow.com/questions/...my-zsh-history



Please mark this thread as solved.
Thanks for the link !!! I saw a way to do it which is executing this command on the terminal:

Code:
echo "" > ~/.zsh_history & exec $SHELL -l
If you want to make it as a command, you can create an alias with these steps:

Code:
open ~/.zshrc
add the following line

alias clear_history='echo "" > ~/.zsh_history & exec $SHELL -l'
Save and close the file

Close the console or type zsh
if you to see the result directly, but this will open another zsh shell in the old one
Now you can clear the console typing clear_history
It is kind of workaround, but it works. Thanks for your time and help. Have a nice day.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kali here, Kali there! Why you should not expect detailed answers. onebuck Linux - General 39 02-11-2022 03:09 AM
LXer: Migrating from Kali Linux 2 to Kali Linux 2016.1 LXer Syndicated Linux News 0 02-01-2016 07:50 AM
Failed to fetch http://http.kali.org/kali/dists/kali/Release.gpg aymeric75 Linux - General 2 07-11-2015 05:10 AM
Why does BASH history command have no history when run in script ? lump_of_lard Programming 4 01-30-2015 09:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration