I am using bash. Say,while I am running pacman -Syu I want to change terminal title from user@host:pwd to pacman -Syu and want to get back user@host:pwd when terminal is idle. So, how can I do that? I guess, almost terminal emulator supports printf &quot;\033]0;Title\007&quot;.
20732
My Bash Prompt is currently setting the xterm titlebar using the following sequence:  PS1='\033]0;\u@\h&gt;\w\007'   Is there an easy way to display the current command in the titlebar. For example, if I am tailing a file using tail -f foo.log, I want my titlebar to say tail -f foo.log.
1459
I would like to open a terminal, split it to lets say 9 parts (3x3) and execute some bash script. But for each terminal part different script.   Can this be done using perl, python or even bash?  How can I switch between those little terminals without using keyboard shortcuts?  Oh, by the way, I'm using terminator. And if there is some other terminal emulator that enables such a functionality, which is it?
64931
I have a user, say user1, which has modifications to its .bash_profile, one of them changing the PATH, e.g.: export PATH=/some/place:$PATH. This change works fine if I log on as user1 or do a su - user1.  But if I try to run a command via su as root, e.g.:  su -c test.sh oracle   (test contains echo $PATH)  It doesn't seem to have the modified PATH (or root's PATH, for that matter). I've also tried copying .bash_profile to .profile, to no avail.   Why is this happening?
59051
When I open Terminal I expect it to show what my PS1 is set to \h:\W \u\$.  However it's not displaying my hostname Eriks-MacBook, as displayed in System Preferences.  Instead, it's showing a random string unknownb88d120cd4b2.   How can this be fixed or reset?  This machine is brand new, and the preferences/settings haven't been changed.
71067
I was surprised that I didn't find this question already on the site. So, today $ came up after I logged in as a new user. This was unexpected because my main user's prompt starts with username@computername:~$.  So, how do I switch from this other shell to bash?
14819
How can I change prompt name seen at terminal?  my prompt :  &lt;user_name&gt;@&lt;user_name&gt;-MEGA-BOOK-VR320:~$   It is too long. I want to change it to:  gcc :    However, I should see the path when I go from one directory to another.  gcc :~$ cd X_directory gcc :~/X_directory$   How can I do that, permanently?
53939
I want my shell prompt to look like a cheeseburger! 🍔🍔🍔  It would be nice if it also displayed: username, hostname, and current directory.
99673
Note: I reworked the question to clarify the issues. This is a trivial question that can be answered in several parts because the question has several attributes.  Unfortunately, the question may be reworked when the person asking the question apprehends (knows) some parts of the answer as well as the structure of the question.  Therefore, the question is presented from a different point of view than the original one.  How to change the color setting¹ of the Linux console, using a shell utility? How to change the color setting¹ of a terminal emulator, using a shell utility?  Originally, I wanted to change the background color of the Linux console during the execution of a shell script. The following proposition works as I wanted.  #!/bin/sh  # set the background color of the terminal tput setab 6 clear  printf "%s\n" 'background: cyan'  # do some tasks  cd /usr/src/initramfs pwd ls -l  # the background of the shell output is cyan   Nonetheless, someone may encounter several glitches (or difficulties).   For instance, if the screen is not cleared, the background color is only applied to the text output, during a shell script execution. If the command tput setab 6 is submitted with the command line and the screen is not cleared, the background color is only applied to a small portion of the output text. If the command tput setab 6 is submitted on the command line and the screen is cleared, the background color is applied to the full screen but only persists until another command is submitted. [...]  ¹ background color
12192
By typing a manually specified command in terminal I want to execute some other command.  How could add an alias to a command? Can i do that with the help of the terminal or should I edit some kind of file?
27663
I just ran this a few seconds ago. I managed to do Ctrl - C as soon as I realized what I started doing.  So far the only directory it's started going through is /bin.  I'm afraid to do anything else. So far I realized I can't use su as my normal user anymore.  Luckily I still have another root terminal open. What do I do?
40901
For some special purpose, I want to prevent non-root users of the Linux Server from changing or renaming the filenames. However, they can modify and write to the contents of the file. How to do this from command line.
45209
I have recently joined Ubuntu version 16.04. When i open the terminal it displays this message "To run a command as administrator(user "root"), use sudo command ". Please help me with this problem asap.  It happened to me (@waltinator), too. I did CtrlAltt to open a teminal, and is my wont, did 3 CtrlShiftt to open additional teminal screens. The additional screens got the message:  To run a command as administrator (user "root"), use "sudo &lt;command&gt;". See "man sudo_root" for details.   before my .bashrc finished.    I can't find anywhere in my .bashrc or its included files where I attempt to sudo anything (sounds like a Bad Idea) during my login process. I do set up aliases that sudo when evaluated, but not when defining the alias:  $ egrep 'sudo |su ' .bashrc .bash_aliases /etc/profile.d/color_ls.sh etc/bash_path_funcs/*  .bashrc:# makes "sudo" easier: sudo less $LESS files .bash_aliases:alias bigopenfiles="sudo lsof / | awk '{if(\$7 &gt; 1048576) print \$7/1048576 \"MB\" \" \" \$9 }' | sort -n -u"  .bash_aliases:alias deletedfiles="sudo lsof / | egrep 'PID|\(deleted\)'" .bash_aliases:alias bigopenfiles="sudo lsof / | awk '{if(\$7 &gt; 1048576) print \$7/1048576 \"MB\" \" \" \$9 }' | sort -n -u"  .bash_aliases:alias deletedfiles="sudo lsof / | egrep 'PID|\(deleted\)'" .bash_aliases:alias aptfixkey="sudo gpg --keyserver keyserver.ubuntu.com --recv-keys " .bash_aliases:alias susp="sudo -v &amp;&amp; sleep 20 &amp;&amp; echo 'Zzzzzzzzzzzzzzzzzzzzz' &amp;&amp; date &amp;&amp; sudo pm-suspend &amp;&amp; date &amp;&amp; echo 'Awake'" .bash_aliases:alias update='wupdatestatus=99;while [[ $wupdatestatus -ne 0 ]] ; do sudo apt-get update; wupdatestatus=$?;echo "status=$wupdatestatus";if [[ $wupdatestatus -ne 0 ]] ; then date; sleep 300; fi; done' .bash_aliases:alias upgrade='wupgradestatus=99;while [[ $wupgradestatus -ne 0 ]] ; do sudo apt-get upgrade; wupgradestatus=$?;echo "status=$wupgradestatus"; if [[ $wupgradestatus -ne 0 ]] ; then date; sleep 300; fi; done' .bash_aliases:alias upgradedl='wupgradestatus=99;while [[ $wupgradestatus -ne 0 ]] ; do sudo apt-get --download-only upgrade; wupgradestatus=$?;echo "status=$wupgradestatus"; if [[ $wupgradestatus -ne 0 ]] ; then date; sleep 300; fi; done' .bash_aliases:alias dist-upgrade='wupgradestatus=99;while [[ $wupgradestatus -ne 0 ]] ; do sudo apt-get dist-upgrade; wupgradestatus=$?;echo "status=$wupgradestatus"; if [[ $wupgradestatus -ne 0 ]] ; then date; sleep 300; fi; done' .bash_aliases:alias wup='wifi;sudo rmmod rt2800usb;sudo modprobe rt2800usb;nmcli con up id Nick;wifi;ping3 slashdot.org' .bash_aliases:    sudo tail -n 50 $( ls -rt1 /var/log |sed -e 's%^%/var/log/%'| tail -n 6 ) grep: /etc/profile.d/color_ls.sh: No such file or directory   None of the logs help:  $ sudo grep -l sudo /var/log/* /var/log/*/* 2&gt;/dev/null     shows nothing interesting.  How do I track down who/what is trying to sudo when I login?
44028
Usually, for some commands such as apt-get install xxx, I forget to add sudo first, then I need to retype it. What I want is in such cases, I just type a simple command, for example resudo. It will sudo my last command sudo apt-get install xxx. Is it possible in bash?
120981
If I wanted to use zsh, for instance, rather than bash, where would I make this change for the current user?
62082
Is it possible to change the background color of Terminal.app from the shell? If so, how?
103350
What command(s) can I use in the terminal that's equivalent to the PrtSc (Print Screen) button?  I am running Ubuntu GNOME.
7608
This is a copy of my post from stackoverflow; I realize I should have asked it here...  I want to run a script that changes the hostname and have my bash prompt (PS1 variable) update immediately with the proper hostname. How do I make this happen?  I run this  #!/bin/bash # Usage: ./changehost &lt;newhostname&gt;  #Do two sed's to edit the files for persistent hostname change sed -i s/$(hostname)/$1/g "/etc/hosts" sed -i s/$(hostname)/$1/g "/etc/sysconfig/network"  #run the hostname command with new hostname to update it hostname $1   In a terminal like so and get this  [user@host dir]# ./changehost newhostname [user@host dir]#    But what I want is this  [user@host dir]# ./changehost newhostname [user@newhostname dir]#    The terminal is updated properly only when I open up a new shell.  I have also tried to do   export PS1='somestring'; export PS1='[\u@\h \W]\$'    outside of the script in the terminal and it does switch to 'somestring' and back, but the hostname is unchanged. :\   Is it possible that the \h is stored in memory when the process begins and can't be changed after startup?