# Tag Info

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 ... 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". ... 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 ... 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 \! \" \# \$ \% \& \'  \* \ \+ \, \/ \: \; \= \? \@  : ...

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 ... 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 ... 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. ... 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'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 ...

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 ... 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 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 ... 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 ... 3 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

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 ...

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:

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" ...

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

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, ...

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 ...

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 ... 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 ... 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). ... 2 The sudeoers file is usually located at /etc/sudoers. You need administrative privileges to edit this file. Editing it directly is strongly discouraged: you could irrevocably damage your system in case of syntax errors. The visudo tool is provided with the sudo package for safe editing. It will automatically check file's consistency before saving and abort ... 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 It's called the prompt. If you type man bash and then search for the word "prompt", you'll find more information. 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 ... 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. ...

Only top voted, non community-wiki answers of a minimum length are eligible