20 votes
Accepted

ANSI terminal color behaves strangely

When AAA\n is printed at the very bottom of the terminal, the terminal needs to scroll the text and make an empty line appear at the bottom. It displays the line using the current background color, ...
10 votes
Accepted

Obtain a list of files in Terminal in same order as in Finder

ls and shell globs sort file lists lexically by their name by default. The GNU implementation of ls has a -v option for version sort which would help you here, but the ls in macos has no equivalent (...
5 votes

why password is not asked when output is shown in another terminal

Because you already have access to the terminal since it belongs to your user. For example: $ tty /dev/pts/10 $ ls -l /dev/pts/10 crw--w---- 1 terdon tty 136, 10 Sep 16 2022 /dev/pts/10 So I own ...
  • 221k
3 votes

Running process in background ruins terminal

watch by design updates the terminal. It "watch"es an object, and displays the current version of that object (or changes to that object with -d). An example of where watch is useful, is ...
2 votes

Running process in background ruins terminal

Is there a way to prevent a process changing the terminal? Not really. The terminal state is global to the terminal and can be changed by any process that has permission to do so. $ tty /dev/ttys007 $...
  • 33k
2 votes
Accepted

Is there a better way to deal with long file paths for copy-pasting files?

Try hitting TAB key twice. Majority of modern terminals have ability to copy-paste text from the screen. Try selecting text with a mouse and RightClick... There are always GUI version of file managers,...
  • 2,285
1 vote

Is there a better way to deal with long file paths for copy-pasting files?

You can move to beginning / end of command line in bash by typing Control + A / Control + E. Using it with a comment can be nifty. Put a '#' to execute it as a comment in bash, and keep it in history. ...
  • 111
1 vote

List disks/volumes

lsblk -o path,size,model --nodeps seems to do exactly what you requested, but for all disks, not just mounted ones.
  • 72.5k
1 vote
Accepted

How is it possible that this doesn't work even if you use quotes?

Hopefully an example will illustrate the difference: the stuff between the single quotes is like what you enter at the read command Entering a name without quotes: f='file 1' touch "$f" ls --...
1 vote
Accepted

Accurately overwriting previous lines of bash terminal output when text is wider than terminal (e.g. wraps mutliple lines)?

About half-way through writing a solution to your question I realised that this is why (n)curses terminal virtualisation is so much easier: it hides all the nasty terminal dependant details (well most ...
  • 93.7k
1 vote
Accepted

Bash macOS terminal Ctrl+C to kill all processes

The signal from a control+c could take sometime between soon to never for all the processes in the foreground process group to respond to, especially if the system is very busy, or when a process is ...
  • 33k
1 vote

How can I control a specific command to be not executed in my terminal?

That's not how Linux or process control works. If you use sudo, you will be able to delete all files. rm -rf / is not the only way to do that; find / -delete is another one, rm -f /**/** yet another ...

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