New answers tagged

3

The screenshot in the question looks like whiptail (a functionally-reduced program imitating dialog, using newt rather than ncurses). The way the title and buttons are rendered is built into each program, making them look different. dialog (and whiptail) use libraries for managing the display of lines, colors, etc. But you may also see newt used in Red ...


1

i believe the package you are looking for is ncurses. Wikipedia describes ncurses as follows: ncurses (new curses) is a programming library providing an API that allows the programmer to write text-based user interfaces in a terminal-independent manner. It is a toolkit for developing "GUI-like" application software that runs under a terminal ...


3

dialog --backtitle "Package configuration" --title "Configuration sun-java-jre" --yesno "\nBla bla bla...\n\nDo you accept?" 10 30


0

For commands like chown that have their own recursion it is fastest to use that option: chown -R owner:group * .* as Stephen indicates. However it is useful to know that the main problem that slows down your use of find is that you invoke chmown on every single directory and file found. It is much quicker to use: find . -type f -exec chown ...


2

Use chown's recursive option: chown -R owner:group * .* Specifying both * and .* will match all the files and directories that find would. The recommended separator nowadays is : instead of .. If you want to change the current directory's ownership too, this can be simplified to chown -R owner:group .


0

Reading source code is helpful, but the suggested examples are complicated. Most useful programs like the one OP is asking about use escape sequences via termcap or curses interfaces. Doing it with curses would be much simpler. Here are the steps needed with termcap: get the terminal description (including the cursor-movement, scrolling region, ...


1

Ok, so it appears this was an issue with the Gnome Dropdown Terminal extension. Under settings > Terminal, I had a custom command setup as "tmux". Removing this solved the issue. When opening a dropdown terminal now, I just run "tmux" manually, and I am able to escape the weird suspended mode using the "FG" shortcut as recommended.


1

In the ncurses terminal database, cvvis is used as documented in the terminfo manual page: cursor_visible cvvis vs make cursor very visible and if there is no difference between normal and very visible, the cvvis capability is usually omitted. The feature is used in curs_set: The curs_set ...


0

I used sed because it can be used with sudo. For example: sudo sed -i '$ a text to be inserted' fileName.file the alternative is very ugly like : sudo bash -c "echo a text to be inserted >> fileName.file" and even uglier when done with ssh.


1

You probably ended up typing Ctrl-Z which suspended tmux. Try typing fg, then enter to continue.


0

This is a good case for the pam_env.so PAM module. Virtual console logins use the login program, so you can open /etc/pam.d/login and add a line such as the following: session required pam_env.so readenv=1 envfile=/etc/vc-environment user_readenv=0 With the accompanying new file, /etc/vc-environment: TMOUT=600 Two advantages to using PAM for this: ...


4

An application running in a terminal has no way to find out from the terminal what the glyphs that the terminal has drawn look like (or even if they are substitute/placeholder characters). One thing the application can do is find out if the terminal supports UTF-8 at all, and if it does, if it supports variable width characters. The method is as follows: ...


2

ps -o user= -p PIDHERE This selects the process PIDHERE with -p, then instructs ps to format the output by printing only the column named user; the = sign means "rename the column user to (nothing)", effectively removing the header line.


0

Do you have xterm installed? xterm is the standard terminal emulator for the X Window System. Install it by: pacman -S xterm


0

There is a Zsh plugin created to do specifically what you request: https://github.com/psprint/ztrace


0

EDIT: a better answer was provided by I-V. To do this automatically, you could use a bash alias. If you add the following lines to your .bash_aliases file in your home directory, you can start any application my_application from the terminal while automatically putting it on the background and subsequently disowning it from that terminal, using the command ...


0

Terminal emulators have control sequences for inserting and deleting characters (and lines) on the screen. But when you are running an application (whether a shell or a text editor), the control sequences you may enter are as a rule not echoed to the terminal. The application reads these special keys and decides what control sequences to send to the ...


1

Terminal emulators cannot edit text on their own, and hence the concept of insert mode vs. overwrite mode doesn't exist on this level. They just send the keypresses to the running application (via the kernel's tty driver), and receive (again, via the kernel tty driver) and interpret data from the application and update the screen accordingly. For the ...


0

@sebastian pointed to these as relevant, but they address only part of the problem: Change default width of gnome-terminal and terminator windows (Ubuntu) Terminal sizes (Gnome) Some of the discussion here is more relevant, but still not helpful: Change the number of rows and columns in the TTY [duplicate] How to change font-size, number of rows / ...


1

Barring some temporary bug report/fix (not found in the port's changelog), FreeBSD does not require xterm to be setuid, and has not used that with xterm since 2011. The port maintainer's comment said - Don't set suid bit. In our implementation, grantpt() and unlockpt() don't actually have any use, because PTY's are created on the fly and already have ...


1

The simplest way is to execute: daemon firefox so you can continue using/closing the terminal itself


1

There is no need to stay with Tilda for the "drop-down" function. Terminator already offers this. To use it, right click on the Terminator window and select Preferences. Then select Window state: as Hidden. You can customise the hotkey in the preferences as well with Keybindings > hide_window.


1

I just had the same question as this, because I though Terminator affords the ability for split windows, but @RAKK is right, tmux can be used as well, here's how: First, I wanted to have a customized bash (which I start with command mybash) start up, that can be done in Tilda with /bin/bash -i -c 'LINES=10 COLUMNS=150 mybash' under Preferences / Title and ...


0

If running nemo from a terminal works for you until you close the terminal, then run nohup nemo & With nohup, Nemo won't be killed when you exit the terminal.


1

If you have the GNU version of more installed: more -d -f -10 foo This displays the file foo 10 lines at a time, pausing with a prompt messsage after each 10 lines. Press spacebar or Enter at each pause to display the next 10 lines. You can also press h or ? at the more prompt to see more's other capabilities. see man more for more details. BTW, if ...


0

Using bash's built-in substring expansion: for f in 2015* ; do mv "$f" "${f::4}-${f:4:2}-${f:6}" done


0

While rename is a very powerful tool, I normally prefer the simplicity of the mmv (multiple move) utility: mmv '????????_*' '#1#2#3#4-#5#6-#7#8_#9' The ? in the search pattern stands for a single character, the * for an arbitrarily long sequence of characters. In the replacement pattern, every #<number> stands for a corresponding ? or * in the ...


0

Using the perl rename command (which is completely different to the rename command from util-linux): rename -v 's/^(\d{4})(\d{2})(\d{2})/$1-$2-$3/' 2015* (use -n rather than -v for a dry-run to test the command first). This perl version of rename may be called prename or file-rename on your system. It is far more capable and useful than the util-linux ...


3

When you press Ctrl-V, the shell will start by ignoring keyboard interrupts and simply take the pressed key combination as the input character. This is easily possible as ASCII is designed to hold all control characters. Of course, on display it has to cheat a bit and show the ^ followed by the corresponding key or otherwise it would output control ...


2

With sed: LC_ALL=C sed -e 's/\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1_\2_\3/' <file


0

quick and dirty not full solution #!/usr/bin/env bash str=$1 yyyy=$(echo "$str" | awk -F '_' '{print $1}' | awk '{print substr($0, 1, 4)}') mm=$(echo "$str" | awk -F '_' '{print $1}' | awk '{print substr($0, 5, 2)}') dd=$(echo "$str" | awk -F '_' '{print $1}' | awk '{print substr($0, 7, 2)}') new_str=$yyyy-$mm-$dd'_'`echo $str | awk -F'_' '{print $2}'` echo ...


0

To rename all such files (with 8-digit dates at the beginning) in the current directory: #!/usr/bin/perl my @files = glob "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_*"; foreach my $file ( @files ) { my ( $y, $m, $d, $rest ) = $file =~ m/^(\d\d\d\d)(\d\d)(\d\d)(_.*)$/ or next; rename $file, "$y-$m-$d$rest"; }


0

On my distribution I have the perl-rename command, which can use a perl-style regex to bulk-rename files. The rename command only accepts a pair of fixed strings for the rename.


0

By "tty1", you mean a Linux virtual console. The unexpected characters in the error message from mv are the separate bytes of UTF-8 encoding, but printed when UTF-8 mode is not turned on. For instance, È is octal 200, the second byte of UTF-8 for both U+2018 and U+2019. The Linux console can be switched into UTF-8 mode with an escape sequence, or using ...


11

Is there some environment variable? Yes. It is the TERM environment variable. This is because there are several things that are used as part of the decision process. It's difficult to generalize here, because not all programs agree on a single decision flowchart. In fact GNU grep, mentioned in M. Kitt's answer, is a good example of an outlier that ...


20

Most such programs only output colour codes to a terminal by default; they check to see if their output is a TTY, using isatty(3). There are usually options to override this behaviour: disable colours in all cases, or enable colours in all cases. For GNU grep for example, --color=never disables colours and --color=always enables them. In a shell you can ...


5

That eol setting is not for the key that would take you to the end of some line-editing buffer, that's a setting of the tty line discipline. It is for its very basic line editor, the one used when entering input for applications (like cat, sed) that don't have their own line editor. That editor doesn't have cursor positioning, the only editing it can do is ...


4

AIX has a /proc filesystem (since about 5.1?) and you can list the open file descriptors for a pid with procfiles: $ procfiles -n 15502 15502 : /home/guest/test Current rlimit: 2000 file descriptors 0: S_IFCHR mode:0622 dev:10,4 ino:2584 uid:100 gid:100 rdev:28,1 O_RDONLY 1: S_IFCHR mode:0622 dev:10,4 ino:2584 ...


0

If XXX is the pid file /proc/XXX/fd/* | grep /dev/pt But you will get multiple lines per pty if the process has it open for multiple roles (like stdin stdout and stderr) But I guess this won't help for AIX vs Linux, unless AIX has changed a lot since I last used it


0

The terminals listed hints that the behavior is seen with Linux: The clues are in the manual page for wall (Solaris for instance is different): wall displays a message, or the contents of a file, or otherwise its standard input, on the terminals of all currently logged in users. Some sessions, such as wdm, that have in the beginning of utmp(5) ...


2

who only shows logins. For example, tmux / screen opens a pty but I think it doesn't count as a login. I think you can find the process (pid) with fuser /dev/pts/14. (I would use lsof on Linux, but fuser should be available on any posix system).


1

Assuming that you didn't install any signal handlers, you can send SIGINT to the process by pressing Ctrl-C if it in the foreground. If it is not in the foreground, you can use pkill -INT -f '^php queuefile.php$'. By default, php will quit on receiving SIGINT. If, for some reason, there is a signal handler installed, you can also try the TERM signal (the ...


2

The behavior of C-m, C-i, etc. is implemented by bash, but the fact that they're the same thing as Return, Tab, etc. is due to the behavior of the terminal. All terminals behave like this because all terminals have always behaved like this and it's what applications expect. The interface between a terminal and an application is based on characters (in fact, ...


0

Two questions, two points: control/J, control/M and control/I are common ASCII controls which most programs assume. bash simply makes it easy to rebind those in readline. most programs which accept special keys such as left-arrow provide a way to recognize the escape key distinguished from those special keys by timing. You probably cannot type fast ...


0

Just try something like: program.exe &> /temp/output.log ; # OR # program.exe &> /temp/output.log & In some circumstances, you might like to keep an eye on it as it changes, with something like: watch cat /temp/output.log # OR # watch --diff cat /temp/output.log Or similarly: watch tail /temp/output.log # OR # watch --diff tail ...


0

Try the command stdbuf -oL ./MyProgram.exe > output.txt The standard output of programs is, by default, line buffered if the output is a terminal, but buffered in 4kB chunks if the output is a regular file (which is the case now, since you redirect it to output.txt). This means that the standard stdio functions (such as printf()) collect the data up ...


1

nohup is probably what you want. nohup's purpose is to "run a command, ignoring hangup signals". In other words, if your ssh, telnet, serial, etc connection disconnects for any reason (other than the host crashing, shutting down, or rebooting, of course), your program will keep running. You probably also want to run the nohup-ed command in the background ...


0

When you want to append to the standard output, you can use >> instead of just >: ./MyProgram.exe >> output.txt 2> error.txt & This will prevent your output to be overwritten every time. That obviously won't stop the process from exiting when the session closes. If nohup is available, you should use it to start your program and ...


0

For coding stuff I have always just used environment variables to store commonly used code directories. In a bash file that gets executed do: export PROJECTNAMEDIR=/opt/too/long/path/to/type/every/time/git-repo Then you can do stuff like cd $PROJECTNAMEDIR or git checkout $PROJECTNAMEDIR and also variables will autocomplete with bash.


2

Open the terminal and type the following commands: sudo apt-get update sudo apt-get install mpb



Top 50 recent answers are included