Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
581 views
nnn file manager not allowing me to press r key for batch rename
I am using Arch and bash. All packages are current and up to date. I am using the `nnn` file manager. I go into `nnn` and make a selection of 3 files by pressing the space bar while over each of the three files. This is how files are selected in nnn. Then I should be able to press the `r` key to bat...
I am using Arch and bash. All packages are current and up to date. I am using the nnn file manager. I go into nnn and make a selection of 3 files by pressing the space bar while over each of the three files. This is how files are selected in nnn. Then I should be able to press the r key to batch edit the selected filenames in neo-vim. When I press r I see failed! in the bottom left hand corner of the terminal. This is a rapid and very useful way to re-name files in a dir. It was working and for some unknown reason has stopped. ps nnn has no .config file to speak of and is set-up in .bashrc. Within .bashrc I have the following: # setup bookmarks in nnn export NNN_BMS='s:/home/$USER/linux_config' # set nnn editor NNN_USE_EDITOR='/usr/bin/nvim' export NNN_OPTS="H"
Kes (909 rep)
Sep 17, 2023, 08:55 AM • Last activity: Sep 17, 2023, 08:18 PM
0 votes
1 answers
73 views
Recover Directory imediatly after failed 'nnn' (filebrowser) renaming
After building a local data-server with a bunch of older hard drives on one HDD I've observed that I had switched the naming of two directories. With the 'nnn' file-browser (with the 'r' keybinding, which calls the 'vi' editor in which you can rename all sub-directories at once) I renamed them how t...
After building a local data-server with a bunch of older hard drives on one HDD I've observed that I had switched the naming of two directories. With the 'nnn' file-browser (with the 'r' keybinding, which calls the 'vi' editor in which you can rename all sub-directories at once) I renamed them how they should actually be -- switched the names. However, after saving and exiting 'vi', one of the two directories has disappeared. Without any changes, I immediatly exited the drive, unmounted it and suspended automatic mounting at startup. The directory included backuped files wich are rather important. Ideally it would be nice if it would be possible to restore the **files including the names and the directory structure**. What are the chances for restoration and how could I proceed?
alex (1023 rep)
Jul 30, 2023, 08:15 AM • Last activity: Jul 30, 2023, 08:27 AM
0 votes
0 answers
108 views
Preserving environment variables (custom shell prompts) in nnn subshells
I run two different terminal emulators with different `zsh` prompts depending on whether I am in one or the other (with the second being the "default"): ```bash TERM_EMU=$(ps --pid $(ps --pid $$ -o ppid=) -o comm=) if [ $TERM_EMU = 'term1' ]; then PS1='term1> ' else PS1='term2> ' fi ``` (Where I hav...
I run two different terminal emulators with different zsh prompts depending on whether I am in one or the other (with the second being the "default"):
TERM_EMU=$(ps --pid $(ps --pid $$ -o ppid=) -o comm=)
if [ $TERM_EMU = 'term1' ]; then
    PS1='term1> '
else
    PS1='term2> '
fi
(Where I have taken the terminal emulator name finding command from this question ) However, I also use nnn for file navigation and frequently spawn its subshells. Whenever I enter an nnn subshell, the process id of the terminal emulator found with the ps command becomes nnn, and the shell switches to the "default" prompt. I want to sync the subshell prompts with my main prompt setting. My first idea was to check if I'm at zero subshell depth first; this would presumably set my shell prompt to a variable that would later be referenced by the subshells:
if [ -z $NNNLVL ]; then
    TERM_EMU=$(ps --pid $(ps --pid $$ -o ppid=) -o comm=)
    if [ $TERM_EMU = 'term1' ]; then
        PS1='term1> '
    else
        PS1='term2> '
    fi
else
    PS1="($NNNLVL) $PS1"
fi
This doesn't work; instead, the subshell prompt becomes
() %
which is not at all what I want; apparently the PS1 variable is not carried over to the subshells. How do I force nnn shells to "remember" their parent terminal emulator?
Andrii Kozytskyi (1 rep)
Jun 19, 2023, 07:12 PM • Last activity: Jun 19, 2023, 07:19 PM
2 votes
3 answers
2163 views
How to Copy Text of a Filename Using nnn File Manager
Using [nnn][1] (which is a terminal-based file manager), how can you copy the text of a file or folder's name to the clipboard? For your convenience, this will install and launch nnn in Debian (if you'd like to help me figure it out): sudo apt install nnn ; nnn [1]: https://github.com/jarun/nnn
Using nnn (which is a terminal-based file manager), how can you copy the text of a file or folder's name to the clipboard? For your convenience, this will install and launch nnn in Debian (if you'd like to help me figure it out): sudo apt install nnn ; nnn
Lonnie Best (5415 rep)
Jul 27, 2022, 02:01 PM • Last activity: Dec 8, 2022, 02:12 AM
1 votes
1 answers
304 views
Strange escape sequences in terminal
I have kitty, and I use nnn as file manager. I actiavted the "preview-tui" plugin in nnn. When I hover over a folder, I see something like this: [![enter image description here][1]][1] What are those strange escape sequences? [1]: https://i.sstatic.net/41p4c.png
I have kitty, and I use nnn as file manager. I actiavted the "preview-tui" plugin in nnn. When I hover over a folder, I see something like this: enter image description here What are those strange escape sequences?
robertspierre (379 rep)
Nov 1, 2022, 05:06 PM • Last activity: Nov 1, 2022, 05:13 PM
0 votes
1 answers
801 views
How to Open a File with SUDO from within nnn File Manager
While using [nnn][1], I need to edit a file that requires sudo privileges. I love that I'm able to navigate quickly to the file I want to edit using nnn, and how it immediately opens the file in my editor. Yet upon making modifications, I cannot save the file without root privileges. This really bre...
While using nnn , I need to edit a file that requires sudo privileges. I love that I'm able to navigate quickly to the file I want to edit using nnn, and how it immediately opens the file in my editor. Yet upon making modifications, I cannot save the file without root privileges. This really breaks the flow of what I like about nnn. Is there a quick way I can launch the editor from a file in nnn (with sudo)?
Lonnie Best (5415 rep)
Jul 28, 2022, 04:14 AM • Last activity: Jul 28, 2022, 06:19 AM
Showing page 1 of 6 total questions