Different shell prompt than usual in Linux terminal
My shell prompt appears to have changed , not sure what I did to cause it though. I am new to linux.
How it appears
bash-4.2$
How I want it to appear
robinhood@ubuntu$
1 answer
-
answered 2018-10-11 23:23
Daniel Kirmani
You can change your shell prompt to be whatever you want. In your case, do the following:
Type into the command line:
gedit ~/.bashrc
Look for the following line (ctrl + F)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
and replace with
PS1='robinhood@ubuntu\w\$'
then save and exit. New instances should have your desired prompt
See also questions close to this topic
-
Kill port on remote server with ssh
I want kill specific port on remote host with below command:
ssh username@remoteip "fuser -k 2323/tcp"
but got
fuser: command not found
error. I spent hours googling for this but I could not find any possible solution.Any idea?
my linux distribution: centos
-
what does address space entail?
I saw this term reading "Operating System concepts". At first I thought they are a specific block in memory with a defined starting address and ending address. But then I read about fork and how a child process copies the address space of its parent, then overlay that address space with an exec call so now I'm starting to think that address space doesnt really have a defined starting and ending space, and when the child process copies the address space, it actually only copies the content into another block of memory with the same size. Which interpretation is correct or both are wrong?
-
How to track PHP transactions on Linux server?
I want to create a daemon to track PHP performance monitoring on a web server.
So I would like to somehow capture every execution of PHP files on the server and note how much time was needed for the execution and the parameters that were sent.
I have no idea where to start or what to use.
For example, the user opens the following page in the browser: http://example.com/dashboard
I want to draw the following information:
Transaction, Server time: /dashboard, 700ms
As a New Relic provides the ability to monitor PHP activity.
-
bash function returns always true
I have a shell script
function fun1(){ return 0; } function fun2(){ return 1; } if fun1 && fun2 ;then echo "success" else echo "failure" fi
which works fine.. I need to wrap this up in double brackets. I am trying to do like this.
if [[ fun1 ]] && [[ fun2 ]] ;then echo "success" else echo "failure" fi
However it always returns success regardless of the return values of the functions..
Can anybody tell me where am I going wrong? However If if run witho
-
for loop iteration on a string which contains *
I have a file which was created by another scripts with file names. Only thing is that it contains * for similar file names. now i want to iterate a for loop on this file to execute a few operation but i want to do it on different servers for that i simply need exact same name from that file. For this, i used grep and passed it to 'for' loop for one by one execution. But instead before going for the loop it actually executes it on current server itself and gives wrong output. I don't know what i'm missing.
# node_name=auxiliary;grep -F $node_name /opt/log_automation/ME_log_sheet.csv|awk -F "," '{print $2}' /opt/tpa/logs/install_SPS.*.log /opt/tpa/logs/localization.log /opt/tpa/logs/SPI.*.log /opt/tpa/logs/TPA_system.log #
This seems to be working as expected as i want * to be present in the name. Now if i put it in a variable or pass it to the loop it expands and gives actual present file which i don't want. I want it to return simply the name with * on it.
# node_name=auxiliary;myvar=$(grep -F $node_name /opt/log_automation/ME_log_sheet.csv|awk -F "," '{print $2}');echo $myvar /opt/tpa/logs/install_SPS.2019.02.09-12:12.log /opt/tpa/logs/localization.log /opt/tpa/logs/SPI.2019.02.09-12:10.log /opt/tpa/logs/TPA_system.log # node_name=auxiliary;for i in $(grep -F $node_name /opt/log_automation/ME_log_sheet.csv|awk -F "," '{print $2}');do echo $i;done /opt/tpa/logs/install_SPS.2019.02.09-12:12.log /opt/tpa/logs/localization.log /opt/tpa/logs/SPI.2019.02.09-12:10.log /opt/tpa/logs/TPA_system.log
Please help me resolve this. What am i doing wrong? P.S.: '-F' with grep i added after a few changes. It wasn't working either way.
-
PHP executing bash script with no ending of it
I have a litle php script which execute a bash script. Those files are :
PHP:
<?php $output = shell_exec("bash script"); print_r($output);
Shell :
#!/bin/bash until ssh -oStrictHostKeyChecking=no root@SOMEIP true ConnectTimeout=5 >/dev/null 2>&1; do sleep 2 done echo "ssh is running"
The bash script is checking if a machine is accessible in ssh. The script is working and returning me
ssh is running
if I run it in CLI. If I call it throught the web browser with php, the page is neverending loading.I use nginx as web server.
-
Copy & paste in non-canonical mod
I'm creating a program to implement a linux shell
I've changed terminal mod into non-canonical
void ft_getch_prepare(void) { int ret; struct termios new_opts; ret = tcgetattr(STDIN_FILENO, &new_opts); new_opts.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOKE | ICRNL); new_opts.c_cc[VMIN] = 1; new_opts.c_cc[VTIME] = 1; ret += tcsetattr(STDIN_FILENO, TCSANOW, &new_opts); } int ft_getch(void) { int c; c = 0; ft_getch_prepare(); read(0, &c, 4); return (c); }
but when I want to copy a string and paste it, it only show the first character of the copied string
For example, I want to paste this string
"HELLO WORLD"
into my terminal, but it only shows the first character"H"
-
I can't install homebrew for Pygame
I'm using Mac OS X. I'm following the steps listed here. I went through at least the first six steps, but when I tried the first time, I did something wrong, and it wasn't working. I thought I'd just restart the whole thing later, making sure I got it all right, but now I can't get past step four.
When I type in
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
it just says
-bash: curl: command not found -bash: ruby: command not found
and when I type in
brew update OR brew doctor
it says
-bash: brew: command not found
Then I followed these steps. The first step worked (so I do have homebrew installed?), but when I tried any of these lines:
git init git remote add origin https://github.com/Homebrew/brew git fetch --all git checkout -B master origin/master
they all replied with
-bash: git: command not found
If you need details for later steps let me know- I don't understand all this terminal commands, sorry for my ignorance.
EDIT: I also tried this video but the first line doesn't work
curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
-bash: curl: command not found
The top comment pinned on the video also says to replace pip with pip3 if it doesn't find the command - this gives me the same error.
-
cURL works from terminal and safari but not from Run script Xcode 9
I am trying to download required framework using runscript in Xcode 9.4. I used Curl with url to download frameworks which works perfectly on terminal as well as safari. When I used same Curl in runscipt it doesn’t work. It unable to download the frameworks. I noticed an error “Could not resolve host” which found in Xcode project build log. Please refer attached screenshots Please help me to resolve this Strange issue.
-
Running a batch file on windows 10
I currently want to run a python file through a command prompt,when the file loads it gives me an updated excel sheet.
I have scheduled a timer on the batch file but it doesnt seem to work.
I am aware that I will probably have to write a program for it, but I haven't a breeze where to start.
Thanks.
-
SQLCMD export to .csv is not separating data int separate columns?
I am trying to use SQLCMD to export data into a .csv file, but when the program exports, all of the data is pushed into one cell, instead of being split into multiple cells. How do I separate the data so that each individual data point has its own cell?
-
How to execute a javascript file with code from C#
I have created a javascript file which is named "index.js". Now I usually execute this file using the command prompt(cmd), using Node.js. Please the exact command I use in the code below.
Now, I like to execute this code from within a C# winform application with the fastest approach possible. I haven't tried to do that in any way since I don't know how to do this. This is why I put this question out.
(I will execute commands like this several times every second. So if it is possible to avoid cmd to open all the time?)
This is the command I use in the command prompt now
I go to C:\myproject folder and then I execute the command: node index.js
C:\myproject>node index.js
I cant find a solution in the added thread/duplicate that supposed to have a solution. This problem uses "node" as the command in the command prompt. The question I ask is very clear. It is only a command in cmd that I want to execute from C# somehow.