Telnet to Embedded linux board: command not found [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm trying to telnet to an embedded Linux based device and I'm able to log in successfully using the root credentials. However, I'm not able to run many bash commands.
Commands like mv, cp, cd, ls, etc. are working, but commands like uname, df, install, etc. (even commands required for POSIX compliance!) don't seem to work. Can't seem to figure out what I'm missing.
# install
-sh: install: not found
# uname -1
-sh: uname: not found
# ls
bin etc lib opt sbin tmp utils
dev home mnt proc sys usr var

Usage of Busybox as shell interpreter is very common in embedded world.
It's an ash interpreter that can be compiled with minimum functionality.
Try to determine shell interpreter you have on your system using this tips:
How to determine the current shell I'm working on?
You can "ls /usr/bin" and "ls /usr/sbin" to see what commands are physically available.

Related

How to programmatically trigger actions when last Linux terminal is exited/killed? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I've modified my .bashrc to mount directories when I start first terminal after login.
If mount point still exists when I start new terminal nothing is done.
Now I want to add a bit of code when last linux terminal is closed/exited (e.g. umount those directories, etc..)
Also there is this not-so-intelligent way of discovering how many terminal instances are still running:
ps -au | grep "bash" | grep "grep" -v -c
I'm running Ubuntu 20.04. and I'm using bash shell.
Questions:
Is there a file which is "triggered" on terminal exit just like .bashrc is on terminal startup? I've tried messing around with .bash_logout but it doesn't seem to do anything in my case (echo, touch..)
Is there another way to do what I'm trying to achieve which doesn't include file from question #1 (if such file even exists)?
You can get it done with the help of trap which is a shell builtin.
For example if you want to clear a folder on running exit command in bash >
trap "rm /cache/*" EXIT
The syntax should be like trap <command> <SIGNAL>
Just put this in the bottom of ~/.bashrc with your desired command and it should run before the terminal is killed.
Try trap --help to know more.

what is the command "-bash" after running "ps -aux |grep bash" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I opened terminal and run the command ps -aux |grep bash to learn the difference between Login Shell and Non-Login shell on my virtual machine's graphical interfaces (Ubuntu Desktop 16.04 x86).
But the output which shows both bash and -bash made me confused. I googled a lot to find out what the command -bash is, but I can only find something about bash, so I come for help.
It means bash is invoked as a login shell. This case it will have a hyphen before its name.
From man bash, section INVOCATION:
A login shell is one whose first character of argument zero is a -, or one started with the --login option.

Why 'which -a cd' command doesn't give any output in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
'Which' command gives the full path to the command. All other commands are working except cd command.
Think about how shells and changing directories work: For each command you enter it will start a new process for the command. Changing directory only applies to the currently running process. If the cd command was executed as an external command, then it would run it its own process, change its process directory, and then the process would exit and the parent process (the shell) would not know anything at all what the child process did.
Therefore the cd command can only be internal to the shell. It has to be parsed and executed completely by the shell and its own process.
cd is a builtin command in bash.

Change dir after 'sudo -i', in one command [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Is there a way to switch dir after doing sudo -i (in one command)?
We use lots of ssh connections on work, and it is a pain to manually set them up when you reboot your pc. So I'm trying to make aliases like ssh remote-dev -t 'sudo -i; bash -l', which connects me to a machine and makes me root there (it is required to do that way; because of Kerberos we can't directly ssh root#...)
So what I would like to do now is expanding the above command in a way that I can also tell it to switch to a specific dir after the sudo, or open a specific file, or tail a logfile or something... Is that possible?
-- edit: Of course you could tell it to do some command everytime someone logs in via ssh. But this is a bad option, because only I want to have these commands to be executed; When other people connect to this machine, they probably want different commands.
-- edit: Sorry I posted it here, did not realize it is offtopic in stackoverflow
Try
sudo -i bash -c "cd /path/to/dir; exec bash"

in linux what are ls flags in sftp [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
in linux, we have lots of flags to list files in command ls. we can't do the same inside sftp commannd. For example, in linux, I can list a file's full time by runnling command:
ls --full-time filename
when I sftp to a server, I can't run command: ls --full-time.
The ls help in sftp doesn't list all available flags. So can you please tell me what are ls flags in sftp?
Thank you!
The ls command in sftp is an internal sftp command which is in no way related to the ls command of the remote system's core utilites.
sftp (which has a similar interface as ftp) provides it's internal commands to allow listing of files(among other commands), which does not invoke the ls of the core utilities. So do not expect the same behavior.
For more details on sftp's internal commands please refer to sftp manpage or this page

Resources