# Tag Info

2

In bash you can test as follows: [[ tty = "/dev/pts/1" ]] && echo Access Granted. Welcome. tty will generally output something like /dev/pts/1 or not a tty As you mentioned, apparently in csh you can do as follows: if ($tty == "pts/1") then echo Access Granted. Welcome. endif -2 Another, using the bash options set internal variable,$-. From .bashrc, # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac 5 From man bash under CONDITIONAL EXPRESSIONS: -t fd True if file descriptor fd is open and refers to a terminal. Assuming fd 1 is standard out, if [ -t 1 ]; then should work for you. The Advanced Shell Scripting Guide claims that -t used this way will fail over ssh, and that the test (using stdin, not stdout) should therefore be: if [[ -t 0 || -p ... 0 Test for the existence of the PS1 environment variable: # If$PS1 is null, not being run from a shell if [ -z $PS1 ] Alternatively you can test for it being not null, i.e., run from the shell if [ -n$PS1 ]

0

You may be seeing this special behavior documented under :help :bnext: If you are in a help buffer, this takes you to the next help buffer (if there is one). Similarly, if you are in a normal (non-help) buffer, this takes you to the next normal buffer. This is so that if you have invoked help, it doesn't get in the way when you're browsing ...

0

In the terminal you would use apt-get to upgrade the package. You would want to try: sudo apt-get install --only-upgrade <packagename>

1

You could use a pager like less or more: less screenlog.0 Or more screenlog.0 Not sure what terminal escape codes you have but if they are not displayed correctly, use less -R screenlog.0

-1

Here is a solution for OS X that incorporates iTerm 2, tmux, and mosh. The native scrolling is accomplished through some magic between iTerm 2 and tmux.

2

Terminals transmit characters (more precisely: bytes), not keys. When you press a key or a keychord like Ctrl+;, this information has to be encoded into a sequence of bytes. Keychords that represent a character, like A or Shift+A or À, are sent as that character: a, A, à (the last one being one or two bytes depending on the terminal's character encoding). ...

8

So, with Terminology (probably the very best thing that ever happened to a terminal emulator, by the way) at the time of this writing the following works: ytplay() ( init() if [ "${#1}" -gt 0 ] && i=$? du= f= then durl \! \" \# \$\% \& \'  \* \ \+ \, \/ \: \; \= \? \@  : ... 5 Perhaps your confusion arises from not having used an actual terminal. Back when serious computers were the size of several upright refrigerators, a terminal communicated with a central computer over a serial cable using characters and characters only. The characters were part of some standardized character set, e.g. ASCII or EBCDIC, but typically ASCII. ... 2 Assuming the file and directory names don't have newlines in them: diff <(cd alpha ; find . -type f) <(cd beta; find . -type f) The find commands list the files in the directories the cd changed to and the diff compares the listings. Output looks like: 1c1,2 < ./b/c/file.x --- > ./b/c/file.d > ./b/c/file.e with < indicating files ... 0 Good point, I have not noticed it that this was still the case, but however. There are ways how to limit the damage it can do, maybe with this new capsicum they are working on. But for all X (Xorg) applications I would say, first Wayland has to come in and then we can talk about security on a computer that is running X for real. Such little problems, like ... 1 It's called the prompt. If you type man bash and then search for the word "prompt", you'll find more information. 2 Although this won't exactly reverse output, it will keep your prompt at the top: https://github.com/swirepe/alwaysontop To use it run: git clone https://github.com/swirepe/alwaysontop.git cd alwaysontop/ source alwaysontop.sh If you decide you like it just source it in your .bash_profile with something like: echo "source ~/alwaysontop/alwaysontop.sh" ... 5 libcaca will display in your current terminal if$DISPLAY is not set. So you can do something like: DISPLAY= mpv --quiet -vo caca 'https://www.youtube.com/watch?v=bvYgBty6nJs' The same trick works with mplayer, though it doesn't (AFAIK) have integrated libquvi support, so you have to extract the video URL to pass it.

4

There is tutorial for this on youtube: https://www.youtube.com/watch?v=QCuq0_nY3Xk According to that video the following should work: mplayer -cookies -cookies-file /tmp/cook.txt $(youtube-dl -g --cookies /tmp/cook.txt "https://www.youtube.com/watch?v=QCuq0_nY3Xk") You can create a simple function for this purpose: playtube () { mplayer -cookies ... 86 You can download videos and/or just the audio and then watch/listen to them using youtube-dl. The script is written in Python and makes use of ffmpeg I believe.$ youtube-dl --help Usage: youtube-dl [options] url [url...] Options: General Options: -h, --help print this help text and exit --version ...

0

TERM=xterm mono Source/PashConsole/bin/Debug/Pash.exe solves the problem. The default TERM=xterm-256color causes the garbage on the terminal. This is not a problem with gnome terminal, not even Pash, but with Mono, see https://bugzilla.xamarin.com/show_bug.cgi?format=multiple&id=18315

1

This part from the XFCE FAQ: If you are running the Xfce desktop environment, enable Editable menu accelerators in the User Interface Preferences dialog. If you are running GNOME then you can enable Editable menu accelerators in the Menu and Toolbars control center dialog. Otherwise put the following in your ~/.gtkrc-2.0 file (create the file if it ...

9

There are errors in your assumptions, but first some background: You should discern two uses of -exec: with \; the {} will be replaced by a single item found with + the {} will be replaced by many items (as many as the commandline can hold). Therefore your example of -exec use invokes as many cp command as items found by find. Using find ... -exec ...

4

There's one big issue here: under the linux console there's no way to distinguish Ctrl-Down from Down, they both send the same ^[[B sequence. To make it work we'd need to find a hack for the linux console to change that. Not pretty, but if you care enough about it it might be possible. Otherwise, how about using another key binding ? Say Alt-/, Just need ...

0

There is no general method. As observed by vinc17, different terminal emulators let you configure the TERM value in different ways, if at all. You can drop terminfo configuration files into your home directory, organized as ~/.terminfo/INITIAL-LETTER/VALUE. For example, if you wish for xterm to point to the 256-color entry, on a typical machine, you could ...

2

Check if your version of mc is compiled with subshell feature. You can check this by running: $mc -V ... With subshell support as default ... A quick Google search returns the following 2 results: Re: no subshell in mc with screen MC doesn't give a subshell for normal users On my laptop, when I hit ctrl+o, I can see in the strace output that the ... 3 The / character is an operator in sed. Basically you are ending up with: sed '//sbin/iptables -A INPUT -p tcp -s "{ip}" -j DROP/d' /root/ip.txt This means that you are trying to execute '//sb' as a sed command, where b is the separator, and it cannot find another 'b'. You would need to quote the special characters: udprule="\/sbin\/iptables -A INPUT -p ... 2 You can do this in your terminal configuration. For instance, with Xterm, this can be done via the X resources. You can do this via the Xterm app-defaults: *termName: xterm-256color or via a -tn xterm-256color option. This is similar for rxvt. 2 If I understand correctly, you're looking for something like this (in bash): #!/usr/bin/env bash ## avoid errors if a directory has no *tex files shopt -s nullglob directories=("Cardiology" "Rheumatology" "Surgery"); ## Change this to set whichever options you want. printf "%s\n%s\n" "\documentclass{YOURCLASS}" "\begin{document}" for directory in ... 2 MC runs bash in a terminal. It leaves TERM set to the same value as the terminal that MC is running in, but it appears that it buffers or filters some exchanges between the inferior shell and the terminal. You may want to use different customizations when bash is running as a direct subprocess of MC. Since MC's inferior shell only shows the prompt line, ... -1 Avoid gnome-terminal at all costs (there is no reason you have to use the terminal emulator that is made by the same people as your DE). It is a terrible terminal emulator that eats keystrokes and violates all sorts of standards. I prefer xterm, despite its lack of frills, although konsole (from KDE) is still pretty high quality but offers a lot of the ... 3 It is waiting for input from stdin, as far as I understand. 3021 13:58:57 read(0, <unfinished ...> 3019 13:59:06 <... select resumed> ) = 0 (Timeout) You need to find what it is doing. However my guess: read -sdR CURPOS You can remove this read in order to try to fix the problem or change its timeout 0 You could try running two separate tmux sessions at once - one for you, and the second for the other user. Then, use your OS's windowing system to arrange two terminals side by side, with one for you and one for him. If you need to write in his terminal, just choose it for input. You run (each command in its own terminal): tmux new-session -s Alice tmux ... 0 I found a way in doing this by editing /etc/fstab file. A simple entry looks like: /dev/sdb1 /media/robot/hdd1 ntfs defaults 0 0 <file system> <mount point> <type> <options> <dump> <pass> 1 Suggestion #1 I don't think you can run an XTERM like this since the RPM when being installed is run under a different userid (root) than the use that owns the desktop. For this to work, at a minimum, you'd need to perform a xhost + on your primary desktop as your userid, and then be sure to set the$DISPLAY environment variable in that call to XTERM. ...

2

Here is a scheme I made some time ago about how sshd works. It doesn't concern the operation of line discipline and stuff, but it adds a real-life illustration of who interacts with what:

0

This seems to work on my machine: gnome-terminal --geometry=260x25-0+0 --tab -e "bash -c 'date; read -n1'" --tab -e "bash -c 'echo meow; read -n1' " --tab --tab Please note, as soon as the processes executed by -e are done running, they will terminate. In this case, bash is loaded, runs whatever commands you pass to it, and immediately exists. I put in ...

25

There are several aspects at play in what you're asking. First, bash doesn't define colors. In fact bash has absolutely no idea that colors even exist. All it knows is that you told it to output the characters \033[0;36m. Your terminal emulator (xterm, gnome-terminal, whatever) receives these characters and understands "I need to start outputting in cyan". ...

7

If you want something like that, just add the lines to your ~/.profile: GRAY="$\033[1;30m$" LIGHT_GRAY="$\033[0;37m$" CYAN="$\033[0;36m$" LIGHT_CYAN="$\033[1;36m$" NO_COLOUR="$\033[0m$" Or, to have them only on demand, add them to a file in your $HOME and source it in your scripts: . ~/.mycolors To make them available globally, add to ... 3 The C- notation doesn't refer to actual keyboard hardware combinations. They refer to ASCII control codes. Historically, the notation was used to indicate ASCII characters between 0 and 31 by subtracting 64 from the ASCII value of the character used in conjunction with C-. For example, C-@ represents ASCII 0 (NUL) because @ is ASCII 64; C-G represents ASCII ... 2 Instead of copying what is displayed on the terminal (only what fits on the screen, with), copy the actual text. Use one of the external utilities xsel or xclip (they have mostly the same features, I'll use xsel in this answer) to copy data from or to the X clipboard. To copy to the clipboard, pass the desired content on standard input. When pasting from the ... 1 The program ag (I'm not familiar with it), could use the system call stdout_is_tty = isatty(1); The isatty() function tests whether fd is an open file descriptor referring to a terminal. This allows it to modify the output depending on where it is writing to. I also think I found the relevant source code section /* If we're not outputting to a ... 0 Something like ␛[01;38;05;129m, where the first character ␛ is the ASCII escape character (U+0027), is a terminal escape sequence. It instructs the terminal to start displaying bold, blinking text in color 129. \e is bash syntax for the escape character (inside$'…', in PS1, in echo -e and in printf). $and$ are not terminal escape sequences, they're ...

2

The "non-printing escape sequence" is needed when using non-printing characters in $PS1 because bash needs to know the position of the cursor so that the screen can be updated correctly when you edit the command line. Bash does that by counting the number of bytes in the$PS1 prompt and then that's the column number the cursor is in. However, if you place ...

1

Most terminal emulators will not render all the text when there's a lot of output in a short time; they will skip data to save time. E.g. rxvt has the -ss option for "skip scrolling" (multiple screens per refresh) and -j for "jump scrolling" (multiple lines per refresh).

0

The issue is my $LESS contains -X. Plus -+X will set less to it's default behavior, which is whatever is specified in$LESS, NOT no -X. Thus I was running less with -X all the time. That's why neither cleaned the screen.

2

# The "sed -r" trick does not work on every Linux, I still dunno why: DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"' => howto use: <commands that type colored output> |${DECOLORIZE} tested on: - AIX 5.x / 6.1 / 7.1 - Linux Mandrake / Mandriva / SLES / Fedora - SunOS

1

chsh is the program for configuring your login shell. chsh -l will list the available login shells. It's best to keep an existing shell session open when modifying your login configuration so as to prevent inadvertently locking yourself out! I'm not familiar enough with zsh to tell you what elements of your .bashrc might be problematic to copy over.

1

Termbin.com supports what you need. $grep --color=force foo /etc/motd | nc termbin.com 9999 http://termbin.com/xxxx$ curl http://termbin.com/xxxx You'll get exactly what you sent. The service is running on a free and open software called Fiche so you can also install your own.

Top 50 recent answers are included