0

In windows when I run "tasklist", the command prompt returns the list of process, I thought it was a built in function, but it was just an executable in System32 directory. Now I wanna ask whether the 'ps' command in linux is also an executable or a built in command of Bash terminal itself.

another question: Is SSH only a Bash Terminal?(But of course with some advanced feature, like over the net)

  • Bash is just one shell among many alternatives in the Linux/UNIX world. Some have more commands built-in, others don’t. You asked for Bash specifically though, so that’s what the answers are about. – Daniel B Apr 7 '18 at 12:33
4

To list all built-in commands:

compgen -b

To get information about a single command , you can use type command. e,g:

type -a cd
cd is a shell builtin

or (check it ):

compgen -b | grep cd
cd

Example 2:

compgen -b | grep ssh

Return nothing , ssh is an external command.

More information :

| improve this answer | |
2

I'll answer the first part. First, a shell builtin:

$ help command
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.

    Runs COMMAND with ARGS suppressing  shell function lookup, or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.

    Options:
      -p    use a default value for PATH that is guaranteed to find all of
            the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND

    Exit Status:
    Returns exit status of COMMAND, or failure if COMMAND is not found.

Next, use the command builtin to check out ps.

$ command -V ps
ps is hashed (/bin/ps)

Thus, ps is its own binary.

| improve this answer | |
2

Well, ps is an standalone binary. Try which cmd or whereis cmd to find that about any 'cmd'. You may also find .exe ports for such unix/linux commands for windows.

SSH opens a text-based communication channel (virtual terminal) between you and a remote machine. 'bash' is one of the mostly used shells, but there are also others such as tcsh, csh, ksh, etc. So in simple words, SSH is not just a bash terminal.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.