date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,303,813,546,000 |
I am having this issue for about 2 years now (since I started to use tmux in Summer 2018) and I have not found a solution to this problem. Any help is greatly appreciated!
The copy functionality of tmux is slow. Often times when I copy using mouse selection, and then I paste in the terminal it almost always pastes wha... |
reattach-to-user-namespace should not be necessary anymore, you can try without it entirely.
There is little tmux could be doing to make copying a small amount of text take a couple of seconds so probably this is pbcopy.
If your terminal supports OSC 52 (iTerm2 does, I'm not certain about alacritty), you could use it ... | tmux copy is slow on macOS |
1,303,813,546,000 |
I want a new session with two windows named mutt and offlineimap. the offlineimap window should be split into two using two different offlineimap instances (with different profiles).
tmux new-session -d -s mail -n mutt mutt
tmux new-window -d -t mail -n offlineimap "offlineimap -c ~/.dotfiles/mutt/dev.offimap"
tmux sp... |
You wrote:
tmux new-session -d -s mail -n mutt mutt
tmux new-window -d -t mail -n offlineimap "offlineimap -c ~/.dotfiles/mutt/dev.offimap"
tmux split-window -d -v -t mail "offlineimap -c ~/.dotfiles/mutt/trash.offimap"
Try this instead, write this into a tmux_mail.sh or whatever you wish to name it:
#!/bin/bash
tmu... | tmux: creating new split window doesn't work |
1,303,813,546,000 |
What are good reasons to use linux terminal multiplexers such as screen and tmux instead of physical terminal?
|
Multiplexers provide additonal functionality that may be of benefit to your workflow; this includes:
configurable scrollback (ie., number of lines to retain)
searchable scrollback
cut/copy and paste between clients (windows)
persistence across sessions
status line for system information
The most significant benefit ... | Advantages of using linux terminal multiplexers |
1,303,813,546,000 |
How can I get tmux to execute a command and then detach (That is, automatically in a single line without further input beyond initially starting the session)?
I don't know to write sophisticated scripts. But I used to do this in screen with a command like:
screen -S torrent -d -m qbittorrent-nox
But I have been readi... |
From the manual:
new-session [-AdDEPX] [-c start-directory] [-e environment] [-f flags]
[-F format] [-n window-name] [-s session-name] [-t group-name] [-x width]
[-y height] [shell-command]
(alias: new)
Create a new session with name session-name.
The new session is attached to the current terminal unless -d is
given... | How to execute a command in tmux and detach using a single line command? |
1,553,666,833,000 |
I'm trying to recover data from a Windows (NTFS) disk that became unreadable for some reason. I'm doing this from within a Linux Mint environment.
I can see the partitions normally, and I also see the correct free space of the disk. However, mounting it gives problems:
> sudo ntfs-3g -o force,rw /dev/sdc1 /media/windo... |
In the end, I gave up solving the problem from Linux, and tried it from Windows. That turned out to be a good idea: running chkdsk solved the problem.
| Recovering data from broken (NTFS) partition |
1,553,666,833,000 |
When I was installing Mint Debian edition unlike the classic edition, the installation automatically formated my home partition when I did not specify to format.
So the formatting previously was ext4 as is now. I believe the data is still there as it was a quick format.
I have now booted the computer up on a live USB... |
Take a look at the e2fsprogs package. It seems that you can get all your backup superblocks from dumpe2fs /dev/sd<partition-id> | grep -i superblock and then have e2fsck check the FS for you, or just try to do mount -o sb=<output-of-dumpe2fs> /dev/sd<partition-id> /your/mountpoint with a backup superblock. See this fo... | Data recovery from an accidental format on ext4 partition |
1,553,666,833,000 |
I was trying to resize my LUKS crypt following this https://wiki.archlinux.org/index.php/Resizing_LVM-on-LUKS and I got to the partition resize with parted and seriously screwed things up. I typed 870 as the new size and forgot to put a G on the end. It shrunk my partition down to 870M I immediately resized it to 870G... |
You can't fix LVM by growing size back to original size, unless you were very lucky and the LV had no fragmentation whatsoever due to previous resizes. Chances are the new LV will have the first 20G or so of your original filesystem but the remaining 780G (or whatever) are scrambled eggs (wrong data, wrong offset, wro... | LVM Filesystem recovery |
1,553,666,833,000 |
I booted to a live Ubuntu USB, wanting to delete partitions on an SD card, and ended up deleting all my partitions on my MacBook Pro's internal HD.
I have already tried gpart (which gets stuck at "Begin scan...") and testdisk (which can't create partitions since "Function write_part_mac not implemented"!).
I did try c... |
Intel MacBook Pro's use GUID partition table for disk partitioning which one can edit with gdisk.
A copy of the partition table metadata is usually stored as backup of the primary. You can read more detail about it on the Arch Wiki here
You need first to know the device name, /dev/sda, /dev/sdb of your Mac disk.
You c... | Recover partitions Mac OS internal HD |
1,553,666,833,000 |
I wanted to make a bootable USB stick from a Knoppix.iso on GNU/Linux with dd.
Situation:
Laptop with Linux Mint on it
HDD mounted to system (.iso file on it) 1TB HDD (800 GB used)
USB stick mounted on system (to make bootable)
command used: $ sudo dd if=/HDD/knoppix.iso of=/dev/sdb
What happened:
I accidently typed... |
The good news is that the knoppix iso is relatively small compared to your drive size so even with the 1-2 minutes (an eternity in computer terms) only about 1% of your drive is overwritten, and most of your data is not wiped. If it were wiped, then even trying recovery would be almost impossible without huge cost.
Be... | Recover data from HDD |
1,553,666,833,000 |
When recovering data from a formatted external hard disk with photorec command of the testdisk tool, if originally the hard disk had 2 partitions (NTFS and ext), does it make sense to run the command twice for each partition-filesystem type?
|
Although the official documentation states that "photorec ignores the filesystem", even if it was true (it's not), the partition could still play a role, moreso if it's not 4K-aligned.
Consider "How PhotoRec works"
PhotoRec first tries to find the data block (or cluster) size. If the file system is not corrupted, thi... | Is it convenient to run testdisk photorec command once for each original filesystem? |
1,553,666,833,000 |
So I wanted to clean a directory and subdirectories from non .doc|.docx files and I ran the following command:
rm -rf /home/user/dir/dir1/dir11/ !(*.doc|*.docx)
and I just deleted my home directory (hundreds of thousands of files...). My last save is not so recent. It's not the end of the world but it would help a l... |
The problem in your command is the !(*.doc|.docx) construct. The * expands to every file and directory.
You have to cease any further writes to the file system because when files are removed and unlinked (no remaining hard links to them), the file system free the blocks previously allocated for the deleted file, the... | I deleted my home directory... can I recover it? [duplicate] |
1,553,666,833,000 |
I am trying to recover partitioning information using TestDisk. To try things out
I copied all data from the original harddisc to another physical drive using dd as follows:
$ dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror,sync
Running TestDisk on the original drive shows up like this:
Disc /dev/sda - 500 GB... |
Finally, I was able to reproduce the output of TestDisk on the second drive. I simply changed the geometry settings to the ones of the original drive. I did the following:
Lookup the geometry settings of the original drive:
$ sudo sfdisk -g /dev/sda
/dev/sda: 969021 cyclinders, 16 heads, 63 sectors/track
Open TestDis... | How to copy partioning information with dd? |
1,553,666,833,000 |
I have an interesting case, where e2fsck refuses to recognize the file system inside a qcow2 image file. Using testdisk I am able to see the partition, so some markers would be left.
The reason this problem occurred in the first place was because the host of the virtual machine died.
So I choose None as the "type" of ... |
Okay, sorry for answering my own question so soon, but I noticed something flabbergasting. The .qcow2 file was of size 120400379904 Bytes, whereas the conversion of the image with qemu-img convert -O raw gave me an image of size 128849018880 Bytes.
Quite a difference.
Now, if we take the size in sectors found by testd... | How to find alternative superblocks in ext3 file system of partition-less qcow2? |
1,553,666,833,000 |
I just accidentally erased my home directory using the rm command. I am being pointed towards photorec and testdisk to recover the files. However, I have a backup, about 2 or 3 weeks old I think, and I was wondering if either photorec or testdisk are able to recover files by dates (last modification) since I am readin... |
photorec can't recover files by date, but it does recover the metadata of a file if found with it (found it here in the section recovery completed). So after recovering all your data, sort your files by date to find the last ones.
In the link they said that photorec will recover the metadata if found. So he might not ... | Can TestDisk or PhotoRec recover files by dates? |
1,553,666,833,000 |
I'm running Photorec on an external HD connected via USB and it's taking too long, with the estimated remaining time constantly increasing.
Is there a way to create a disk image from that external drive, split it in smaller parts, copy each part to my internal SSD (one at a time) and run Photorec on it? I don't have m... |
You could, but if any file crosses the split boundary, you won't be able to recover it. Of course, you could go for overlapping splits to avoid that problem (overlap size being at least the maximum file size you're expecting to recover). However, it's questionable at best whether you would actually see the desired spe... | Can I split a disk image and run Photorec on each part individually? |
1,553,666,833,000 |
We had a human accident at home and an external hard disk was copied a SD 32gb image card by mistake. The copy should be done to a SD image.
I guess 32gb of the external drive were overwritten, but as far as my knowledge of digital forensics, the most of the information should be there.
Can you please recommend me a g... |
From my personal experience most filecarvers like to make assumptions based on which filesystems they detect. You could create a loop device with 32GB offset just to make sure your scanner/filecarver does not get sidetracked by seemingly valid data you're not interested in (i.e. skip the area you know was overwritten)... | How to scan a hard disk at low level to recover files in partially overwritten partition? |
1,553,666,833,000 |
I don't actually want to do it because I am paranoid, but my question is: can I actually change my drive physical geometry using testdisk and damage a drive to the point of being unrecoverable? Does testdisk support this?
|
No, it is not possible to change the physical geometry of a disk. Hard disks don't have any “physical geometry” that can be changed in software. Hard disks don't even report any physical geometry information to the computer — things like cylinders are a software abstraction that hasn't been related to the hardware sin... | Can testdisk change physical geometry? |
1,553,666,833,000 |
Please don't mark this as duplicate -
I have read many other questions and proposed answers and can't seem to get them to work.
I have 3 1TB hard drives, 2 SSDs and 1 HDD. I accidentally deleted the partition table and possibly formatted the HDD whilst trying to install Windows 10 on one of the SSDs.
I'm trying to rec... |
Just to bring this full circle for anyone who find this in the future.
I spoke to a software engineer at my work, and he advised that I had already achieved the best outcome possible.
I.e. recovering the data with photorec was the best I could hope for, that I wouldn't be able to recover the data within the folder str... | Recover Formatted NTFS Partion |
1,457,671,356,000 |
I am in the process of colorizing my terminal’s PS1.
I am setting color variables using tput; for example, here’s purple:
PURPLE=$(tput setaf 125)
Question:
How do I find the color codes (e.g. 125) of other colors?
Is there a color table guide/cheat sheet somewhere?
I’m just not sure what 125 is … Is there some way t... |
The count of colors available to tput is given by tput colors.
To see the basic 8 colors (as used by setf in urxvt terminal and setaf in xterm terminal):
$ printf '\e[%sm▒' {30..37} 0; echo ### foreground
$ printf '\e[%sm ' {40..47} 0; echo ### background
And usually named as this:
Color #... | tput setaf color table? How to determine color codes? |
1,457,671,356,000 |
I'm encountering an issue where I am trying to get the size of a terminal by using scripts. Normally I would use the command tput cols inside the console, however I want to be able to accomplish this feature by strictly using scripts.
As of now I am able to detect the running console and get its file path. However I'm... |
The tput command is an excellent tool, but unfortunately it can't retrieve the actual settings for an arbitrarily selected terminal.
The reason for this is that it reads stdout for the terminal characteristics, and this is also where it writes its answer. So the moment you try to capture the output of tput cols you ha... | Getting console width using a bash script |
1,457,671,356,000 |
tput civis
successfully hides the cursor.
tput cvvis
should unhide it, but it doesn't.
Any idea what the problem might be?
|
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 ... | Hide and unhide cursor with tput |
1,457,671,356,000 |
In people's '.*rc' files I see online or in various code, I tend to see a lot of people who manually use ANSI escape sequences instead of using tput.
I had the understanding that tput is more universal/safe, so this makes me wonder:
Is there any objective reason one should use escape sequences in place of tput? (Port... |
tput can handle expressions (for instance in sgr and setaf) which the typical shell-scripter would find less than usable. To get an idea of what is involved, see the output from infocmp with the -f (formatting) option applied. Here is one of examples using those strings from xterm's terminfo descriptions:
xterm-16co... | Is there any objective benefit to escape sequences over tput? |
1,457,671,356,000 |
I wanted to hide the cursor, and I was aware of tput command. I did search its man page. On searching the Internet, I found
$ tput civis # to hide the cursor
$ tput cnorm # to bring back the cursor
These work perfectly, but these options are not mentioned anywhere in the man page.
Where are they officially documen... |
The tput command uses terminfo (from man tput):
tput [-Ttype] capname [parms ... ]
(…)
For a complete list of capabilities and the capname associated with each, see terminfo(5).
(…)
capname
indicates the capability from the terminfo database. When termcap support is compiled in, the termcap name for the capability is... | Full list of tput options |
1,457,671,356,000 |
Is there some way clear the terminal but instead of leaving the prompt at the top of the screen leaves it in the middle? It looks like clear basically ignores all command-line parameters.
I thought there would be some way to do this with tput but can't find one.
|
You could use tput to move the cursor to a given line in the screen, e.g.,
tput cup 11 0
to move it to the twelfth line (values count from zero).
Along the same lines, you could use tput to clear from that position to the end of the screen, using the ed capability. Combining,
tput cup 11 0 && tput ed
might be what ... | Clear half of the screen from the command-line |
1,457,671,356,000 |
I have created this function, which prints the output as seen in the example image. But, the implementation of this function seems too complex.
Is there a way that I can improve it or implement an alternative solution?
#!/bin/bash
function box_out() {
input_char=$(echo "$@" | wc -c)
line=$(for i in `seq 0 $in... |
As your shebang and syntax indicates unportable bash, I prefer it this way:
function box_out()
{
local s="$*"
tput setaf 3
echo " -${s//?/-}-
| ${s//?/ } |
| $(tput setaf 4)$s$(tput setaf 3) |
| ${s//?/ } |
-${s//?/-}-"
tput sgr 0
}
Of course, you can optimize it if you wish.
Update as requested in comment, ... | bash script , echo output in box |
1,457,671,356,000 |
How can I print $myvar padded so that it is in the center of the terminal, and to either side are = to the edge of the screen?
|
I found two pieces of information here on the stackexchange network that helped me arrive at this working answer:
https://stackoverflow.com/q/263890/5419599
https://stackoverflow.com/q/4409399/5419599
However the code in this answer is my own.
See the edit history if you want more verbosity; I've edited out all the ... | How can I print a variable with padded center alignment? |
1,457,671,356,000 |
I am trying to run a bash script I have via cron, and I am getting the following error at the beginning of the execution:
tput: No value for $TERM and no -T specified
Here is what is in my crontab:
0 8 * * 1-5 cd /var/www/inv/ && /var/www/inv/unitTest run all 2>&1| mail -r "[email protected]" -s "Daily Inventory Unit... |
Your unit test script probably calls tput in order to generate pretty output showing which tests pass and fail. Under cron there is no terminal and thus no terminal type ($TERM), so tput cannot control the nonexistent terminal.
Your unit test script needs to have 2 modes:
running on a terminal: it can call tput to ge... | tput: No value for $TERM and no -T specified |
1,457,671,356,000 |
I have a function in a bash script: message_offset which is used to print the status of a bash script.
i.e. you would call it passing a message into it and a status, like this
message_offset "install font library" "[ OK ]"
and it would print into the terminal where printf's %*s format is used to always set the ... |
You're making this a lot more complicated than it should be. You can handle alignment with $message and not care about the width of ANSI sequences:
#! /usr/bin/env bash
message() {
[ x"$2" = xOK ] && color=2 || color=1
let offset=$(tput cols)-4-${#2}
printf "%-*s[ %s%s%s ]\n" $offset "$1" "$(tput setaf "... | Is it possible to change font colors in the terminal, without impacting printf's "%*s" padding format? |
1,457,671,356,000 |
To avoid a subshell, what are the ANSI escape equivalents of tput sgr0 for an ANSI-compatible terminal?
|
You could answer that by looking at the output of infocmp:
using the -1 option to print one capability per line for a given setting of TERM (i.e., "ansi"), simplifying a grep:
infocmp -1 ansi |grep sgr0=
and seeing (for example)
sgr0=\E[0;10m,
which tells you that you could do
printf '\033[0;10m'
to get the same ef... | What is the ANSI escape equivalent of `tput sgr0`? |
1,457,671,356,000 |
How do I output a string in the bottom right corner of the terminal?
|
string=whatever
stty size | {
read y x
tput sc # save cursor position
tput cup "$((y - 1))" "$((x - ${#string}))" # position cursor
printf %s "$string"
tput rc # restore cursor.
}
That assumes all characters in $string are one cell wide (and that $string doesn't contain control characters (like newline, tab... | Outputting a string in the bottom right corner of the terminal |
1,457,671,356,000 |
The output of tput ed is empty and I can't figure out why. Other capabilities work fine. Also ed is not missing from infocmp output so tput should match, right?
$ printf '%q' "$(tput ed)"
''
$ printf '%q' "$(tput home)"
$'\033'\[H
I'm using zsh on Mac OS 10.14.6 and iTerm2. TERM=xterm-256color.
|
After more googling and scouring the documentation (mainly terminfo), I finally figured out that I need to fall back to the older termcap code since the capname is not supported for all terminfo capabilities.
ed=$(tput ed || tput cd)
| tput ed is empty |
1,457,671,356,000 |
Wrote a bash function to display the console colors.
But, it seems some of the colors are not possible to show that way! (?)
Also, note the strange "bright black"!
(Note: The below screendump is of xterm, but this is meant to be used in console mode. I had to use xterm to get a screendump. But it looks much the same.)... |
If you check tput colors, you'll probably see that the answer is 8. The way to show the bright colors is by tput bold.
This shows all 8x8x2 combinations of foreground and background, normal and bold.
for cmd in sgr0 bold; do
tput $cmd
for i in $(seq 0 7); do
for j in $(seq 0 7); do
tput setaf $i; tput se... | Print console colors |
1,457,671,356,000 |
I want to redefine keybindings for the commandline of a lisp dialect. The commandline is actually modeled after Vi and implemented with tput/terminfo. I want an alternative version with Emacs keybindings, and I would like to give it a try without using gnu readline or so.
A typical key assignment looks like this:
(se... |
terminfo is probably not going to help you much. In most terminal emulators, you can configure with M-x sends <Esc>x or x with the 8th bit set, and the terminfo entry won't magically be updated when the user does so.
Also, most character sets are 8bits now, so it doesn't make much sense nowadays to use that 8th bit fo... | How to use the Meta/Alt Key with tput? |
1,457,671,356,000 |
Test for terminal color support using tput
#!/bin/sh
colors_supported()
{
command -v tput > /dev/null 2>&1 && tput setaf 1 > /dev/null 2>&1
}
I am currently using this code to establish if tput terminal colors are supported.
It seems to work well, the question is: Is this piece of code POSIX-ly 100% portable and... |
TL;DR
The suggested check will fail to work on some kinds of Unix systems.
Long answer
POSIX doesn't cover this aspect of tput, but read the Portability section of the manual page.
Most systems do use terminfo names (such as setaf).
FreeBSD for instance (although the underlying library is ncurses) provides a tput tha... | All-round 100% portable terminal color support check |
1,457,671,356,000 |
I would like to position the cursor at a specific row/column and print a multi-line file/command that stays aligned to its first coordinate, so that
tput clear
tput cup 5 15
ping www.google.com
would output all subsequent lines in the 15th column. As it is, the first line prints correctly but the following lines are ... |
One way to do it could be to set a tab stop at that position:
trap 'tabs -8' EXIT INT TERM # restore to default tab stops every 8 columns
# upon exit or signal
tput tbc # clear tab stops
tput cup 5 15
tput hts # set one and only tab stop
printf '\r' # move back to the beginning of the lin... | Is multi-line alignment possible with tput? |
1,457,671,356,000 |
I have a shell function that colorizes a filename using tput.
color=$( tput setaf 1 )
normal=$( tput sgr0 )
colorize() {
echo "${color}$1$(normal)"
}
When I call the function, the terminal displays the colorized filename as expected.
$ myScript.sh .
/path/to/dir # (in color red)
Then, if I redirect output to a f... |
short: tput doesn't do that.
longer: your script can do that
For example, check if the standard output is a terminal:
if [ -t 1 ]
then
color=$( tput setaf 1 )
normal=$( tput sgr0 )
else
color=""
normal=""
fi
| Prevent tput escape sequences when redirecting script output to a file |
1,457,671,356,000 |
we have the follwing array - list1 and list2
list1="node23 node76 node 34"
list2="node02 node2 node9 node21"
we want to bold the list2 so list1 will printed without bold and list2 with bold
example
echo ${list1[*]} ${list2[*]}
node23 node76 node 34 node02 node2 node9 node21
so how to insert tput bold in echo so lis... |
IIUC:
echo ${list1[*]} "$(tput bold)" ${list2[*]} "$(tput sgr0)"
| linux + how to use the tput bold in echo command |
1,457,671,356,000 |
Using the zsh shell, I've noticed a difference in the behavior of the tput command compared to bash. For instance With zsh, if you have many things output to a terminal emulator window and you're at the "bottom", if you do tput cup 1, you go back up and everything below is cleared. With bash the output remains and is ... |
zsh outputs its completions below the prompt, so it makes sure that area is clear.
I don't think you can disable it. However you can tell zsh that the escape sequence to clear until the end of the screen is the empty string.
infocmp -x | sed 's/ed=[^,]*/ed=/' | TERMINFO=~/.zsh-terminfo tic -x -
Then, you can start zs... | Cursor movement related tput commands under zsh: can the 'clear' behavior be configured? |
1,457,671,356,000 |
This is my ~/.bashrc:
# ...unnecessary lines skipped...
# man colors
LESS_TERMCAP_mb=$(tput blink) # start bold
LESS_TERMCAP_md=$(tput setaf 2 ; tput bold) # start bold
LESS_TERMCAP_me=$(tput sgr0) # turn off bold, blink and underline
LESS_TERMCAP_so=$(tput smso) # start standout (reverse video)
LESS_TERMCAP_se=$(tp... |
tput is not working because it needs to know the current terminal emulator from $TERM environment variable. When ~\.profile is reading, there's no terminal emulator in use, so tput can't produce any output.
It is possible to specify which terminal capability to use in tput by -T key. So this code will work:
LESS_TERMC... | Setting LESS_TERMCAP_* variables with $(tput ...) in ~/.profile not working |
1,457,671,356,000 |
I captured the output of a script that uses tput to draw certain things on screen. When I perform cat myoutput then everything is well seen (looks like terminal reinterprets it from beginning), but when I edit or pipe that output I see plenty of ansi sequences and all the stuff previous to destructive printing like t... |
What you want is a program that understands these terminal control sequences, and is able to render the final view. Well, such a program is called a terminal emulator. Some of them are graphical – like the program you launch to use your shell, e.g., gnome-terminal or alacritty, others are primarily headless.
The older... | How to "render" ouput from a command playing with tput so only the final terminal-postprocessed result is kept? [duplicate] |
1,457,671,356,000 |
I'm trying to use the tput command in a bash script if statement but for some reason it's behaving unexpectedly. When running the command and then checking the exit code only in the if statement things work correctly, however, when running the command in the if statement directly things no longer work. Here's a simp... |
These statements are not equivalent.
The first is checking whether $? is a non-empty string; it always will be, so the body of the first if will always run. [string] is
True if the string string is not the null string; otherwise, false.
The second is checking whether tput setaf 1 succeeded, or alternatively, whether... | tput command doesn't work in if statement |
1,457,671,356,000 |
I use in my bash script the tput command in order to colored the text
as
tput setaf 2
when I run the script from putty or console every thing is ok
but when I run some external WIN application engine that run the script via SSH
the we get the following error on tput
tput: No value for $TERM and no -T specified
tput:... |
When connecting via ssh, environment variables may (or may not) be passed to the remote application. Also a "WIN application engine" could very well not set TERM at all.
If TERM is putty (or xterm, for that matter), these have the same effect:
tput setaf 2
tput -T putty setaf 2
since the control sequences used for s... | linux + tput: No value for $TERM and no -T specified |
1,457,671,356,000 |
ive written the following script to print out the current line and row every time it changes aka every time i press up,down,left or right but the output is always the same:
row:43:col:141
i believe this means top left of the screen where 0 0 would be bottom right, but im not too sure.
heres my script:
#!/bin/bash
ec... |
tput lines and tput cols return the current size of the window in character units. If you drag the window to change its size, you will (usually) see the new values change interactively. They have nothing to do with the cursor position.
Also, the top left of the window is (0,0). Your bottom right is currently (42,140),... | bash script to get current line and row not working |
1,457,671,356,000 |
How can one retrieve status of terminal settings like smam and rmam ?
Reason is that I set rmam by:
tput rmam
in script, then proceed to set smam on exit:
tput smam
But if terminal has rmam set when script starts, I do not want to set smam on exit.
How can this be done?
|
On terminal emulators which support it, you can use the \033[?7$p escape ("Request DEC private mode") to query that parameter (7 => Auto-wrap Mode):
decrqm()(
exec </dev/tty
t=$(stty -g)
trap 'stty "$t"; return' EXIT QUIT INT TERM
stty -icanon -echo time 1 min 0
e=$(printf '\033')
printf "${e}[... | Get terminal status for termcap capabilities |
1,457,671,356,000 |
I need to clear string in terminal between two positions (not the beginning or end of line). For example, delete all starting from tput cup 5 10 and till tput cup 5 69. One line.
Yes, it's possible simply echo by spaces all this region, but, maybe, is there a better way? Something like clear 10 69 on current cursor li... |
You're looking for the erase character(s) control sequence.
tput cup 5 10 ; tput ech 59
This is not to be confused with delete character(s).
tput cup 5 10 ; tput dch 59
Erasure overwrites with blanks. Deletion moves the rest of the line left.
| bash: clear string between two positions |
1,457,671,356,000 |
Does anybody know what sgr stands for when using tput? It is supposed to reset the colour scheme to its default colour.
|
sgr is short for "Select Graphic Rendition", which is also known as "Set Attribute" (see the terminfo(5) manual; man 5 terminfo).
What you are most likely using is sgr0 though, which resets all set attributes.
| Deciphering the meaning of the `sgr` variable in `tput` |
1,457,671,356,000 |
Suppose I have the following color support in one of my portable shell scripts:
#!/bin/sh
set -o nounset
tput_init_linux () { set_fg_color='tput setaf'; reset_color=$(tput sgr0 2>/dev/null); }
tput_init_bsd () { set_fg_color='tput AF'; reset_color=$(tput me 2>/dev/null); }
tput_init_none () { set_fg_color=':... |
The basic limitation is when turning bold off. Some terminals support the ECMA-48 control SGR 22 (neither bold/faint, does not affect color). However
There is no predefined capability for bold-off in terminfo or termcap (see manual page).
There also is no distinction between turning bold off versus colors off.
For... | terminfo/termcap `tput bold`/`tput md`: portability of bold text |
1,457,671,356,000 |
In OBSD ksh, I had a PS1 which prepended a blank line:
PS1="\n[\u@\h] \w\n\$"
The problem with this was that pyenv prepends the name of a virtual environment when that environment is activated. Here is the relevant bit of the pyenv activation script:
PS1="(porcupine) ${PS1:-}"
This eats the blank line, turning
[myus... |
Assuming I checked the correct pyenv source I would recommend to set PYENV_VIRTUALENV_DISABLE_PROMPT=1 and then build your own custom PS1 without interference from pyenv.
The activated environment should be available as PYENV_VIRTUAL_ENV (or you check what is set after activate with env).
https://github.com/pyenv/pyen... | Adding a newline above PS1 that survives prepending |
1,457,671,356,000 |
For example, if I want the prefix for bold green, I might do Green=$(tput bold; tput setaf 2). This would set $Green to "\E[1m\E[32m". But on an Ansi terminal, it could just as easily have been "\E[1;32m".
Can this be done with tput, or am I asking too much?
|
No, tput won't do this (normally) because you're likely to use only the predefined/standard terminal capabilities, which don't have that combination.
With ncurses, you could define your own terminal description with a user-defined capability, and tput would work with that.
Something like this would combine colors:
inf... | Can tput be used with combined capabilities? |
1,457,671,356,000 |
I comeback with a very strange behavior
when we run this command on Linux redhat machine
echo "$(tput bold)" start write to log "$(tput sgr0)" >> /tmp/log.txt
we get ended bold text in /tmp/log.txt
more /tmp/log.txt
start write to log <----- BOLD TEXT
but when we run it from cron job under /etc/cron.d
*/1 * * * ... |
tput bold writes the character sequence that is to be used to tell the current terminal it is running in to start writing in bold.
It knows the type of the terminal based on the value of the $TERM environment variable. That variable is set by terminal emulators or by getty.
tput queries the termcap or terminfo databas... | tput in a cron job does not output bolded text [duplicate] |
1,457,671,356,000 |
Can anyone on *BSD with GUI please confirm, that the below works on a BSD system correctly or not?
I was trying to create a virtual *BSD test box, but ended up unsuccessful. So, I drained some available resources for correct tput sequences on *BSD... Thank you!
#!/bin/sh
if tput setaf > /dev/null 2>&1; then
# Li... |
No: s/smso/so/ (termcap-names are always 2 characters). The terminfo(5) manual page is the place to go for answering your question as stated.
The manual page shows this:
enter_bold_mode bold md turn on bold (extra
bright) mode
so that md w... | BSD (& Linux) tput - basic interoperable color setup |
1,354,054,247,000 |
As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages.
In the past - before java came in - there were two counter-measures:
If nothing else helps - RTFM ;-)
If even 1. does not help - trace the system-calls and see what is h... |
As ckhan mentioned, jstack is great because it gives the full stack trace of all active threads in the JVM. The same can be obtained on stderr of the JVM using SIGQUIT.
Another useful tool is jmap which can grab a heap dump from the JVM process using the PID of the process:
jmap -dump:file=/tmp/heap.hprof $PID
This ... | How to trace a java-program? |
1,354,054,247,000 |
I have two instances of a process running. One of them is "frEAkIng oUT!" and printing errors non stop to STDOUT.
I want to kill the broken process but I have to make sure I don't terminate the wrong one. They were both started about at the same time and using top I can see they both use about the same amount of memor... |
On Linux, assuming you want to know what is writing to the same resource as your shell's stdout is connected to, you could do:
strace -fe write $(lsof -t "/proc/$$/fd/1" | sed 's/^/-p/')
That would report the write() system calls (on any file descriptor) of every process that have at least one file descriptor open on... | How to find out what process is writing to STDOUT? |
1,354,054,247,000 |
Bash has a sometimes-useful feature whereby if you turn on the "-x" option (I believe the symbolic name is xtrace), Bash outputs each line of script as it executes it.
I know of two ways to enable this behavior:
In the script itself, say set -x
On the command line, pass the -x option to Bash.
Is there any way of tur... |
Use env to ignore the readonly flags.
env SHELLOPTS=xtrace ./yourscript
Alternately, if you have set -x in your parent shell, you can export SHELLOPTS to cause it to be copied into the environment, and thus to the child (thanks to Joe Casadonte for this):
set -x # set xtrace flag
export SHELLOPTS # copy all... | Turn on xtrace with environment variable |
1,354,054,247,000 |
I know of strace, which is super handy for watching system calls. Is there an equivalent that can trace calls to external libraries?
For example, I'm trying to debug some SSLeay misbehavior with a third-party binary that I cannot access the code for (and who's developer is unresponsive). I believe I have nailed down t... |
ltrace -- A library call tracer.
It only works on Linux and in a small subset of architectures. Calls to dlopen()ed libraries will not be traced. Further pointers from man page and /etc/ltrace.conf
| strace for library calls |
1,354,054,247,000 |
Apologies in advance if this post is a bit dense/messy, but I'm having a hard time formulating it better... Basically, I would like to study what happens upon a hard disk write, and I'd like to know:
Is my understanding below correct - and if not, where am I going wrong?
Is there a better tool to "capture" log data, ... |
You've asked way too much in one question—well, technically not, as I guess "is this understanding correct" can be answered quickly: no. But that's not a useful answer.
First, you're right about ata_piix and sd_mod apparently being compiled-in to your kernel. That's a choice you make configuring the kernel—you can omi... | Observing a hard-disk write in kernel space (with drivers/modules) |
1,354,054,247,000 |
When ltrace is used for tracing the system calls, I could see that fork() uses sys_clone() rather than sys_fork(). But I couldn't find the linux source where it is defined.
My program is:
#include<stdio.h>
main()
{
int pid,i=0,j=0;
pid=fork();
if(pid==0)
printf("\nI am child\n"... |
The fork() and vfork() wrappers in glibc are implemented via the clone() system call. To better understand the relationship between fork() and clone(), we must consider the relationship between processes and threads in Linux.
Traditionally, fork() would duplicate all the resources owned by the parent process and assig... | Which file in kernel specifies fork(), vfork()... to use sys_clone() system call |
1,354,054,247,000 |
Is there any way to find some process which is periodically writing to disk (according to hdd led) on FreeBSD 10 with ZFS (maybe turn ZFS into verbose logging mode)?
lsof and other instantly aggregating statistics utilities seems not able to catch anything due to a short time of a moment of a disk access.
|
DTrace is able to report on vfs information in FreeBSD (as well as a raft of other probes). DTrace is enabled by default in the 10 kernel so all you need to do is load the module then run the dtrace script.
Load the DTrace module
kldload dtraceall
Get the vfssnoop.d script from the FreeBSD forums. The whole thread ... | FreeBSD 10 trace disk activity |
1,354,054,247,000 |
I was exploring the tracing of commands using set -x (set +x to unset) in bash:
Print a trace of simple commands, for commands, case commands, select
commands, and arithmetic for commands and their arguments or
associated word lists after they are expanded and before they are
executed. The value of the PS4 vari... |
When instructed to echo commands as they are executed ("execution trace"), both bash and ksh add single quotes around any word with one of several types of meta-characters1.
The meta-characters could have gotten into the word in a variety of ways. The word (or part of it) could have been quoted with single or double q... | Why does bash add single quotes to unquoted failed pathname expansions in a command before executing it? |
1,354,054,247,000 |
I am looking for such kind of a tool on either Unix/Linux platform which can achieve:
I have the source files and I compiled the application myself (the source code is in C, although I don't really think it matters here)
I want to run this application while every function calls are printed/logged to a stdout/file
Fo... |
Using gcov:
$ gcc -O0 --coverage square.c
$ ./a.out
$ gcov -i square.c
$ awk -F '[,:]' '$1 == "function" && $3 > 0 {print $3, $4}' square.c.gcov
1 square
1 main
(where the number is the number of times the function was called (we skip the ones that are never called with $3 > 0 in the awk part)).
That's typically used... | Tool to print out functions being called during run time? |
1,354,054,247,000 |
Using set -x causes my shell to print unrelated stuff. For example:
$ set -x
++ printf $'%157s\r'
$ echo 'hello'
+ echo hello
hello
++ printf $'%157s\r'
The lines starting with '++' are extra. How can I remove those extra lines?
|
The -x flag isn't strictly "verbose", it's:
The shell shall write to standard error a trace for each command after it expands the command and before it executes it.
++ means this line of trace is coming from the shell's own internal processing while it thinks about your prompt. It's probably something that happens i... | set verbose prints unrelated extra lines |
1,354,054,247,000 |
When I run command like iostat -dkx 2 2 via ssh, I get the expected result, but the processes on the local computer are saying alive in status "interruptible sleep". Why is this happening? Is there a way to find out the reason of that behavior?
full command:
$ ssh -o ConnectTimeout=4 -o ChallengeResponseAuthentication... |
There seems to be nothing wrong. The process you are looking at (ssh) has simply nothing to do at the moment you are taking it's process stat.
As long as there is no output from the remotely started command, the "select" blocks, and the process is sent to sleep.
| How to find out the reason why ssh processes are hanging? |
1,354,054,247,000 |
I have a pipeline like this:
command1 | command2
Is there a way to trace both commands simultaneously?
|
You can get a single trace with:
strace -f sh -c 'command1 | command2'
The "-f" will "follow" fork calls into the child processes (so you'll also get any sub-commands invoked by command1 or command2, which may or may not be what you want.) Also, you'll get a trace of the sh process too. If you want each processes o... | Is there a way to use strace to trace different parts of a command pipeline? |
1,354,054,247,000 |
I’m running a linux server at home which is mostly a file and e-mail server and a digital video recorder.
All the data goes on an ext4 partition on a software raid-6.
Every now and then (sometimes twice a day, sometimes twice a month) the whole server locks up. Sometimes I have a kernel report in the syslog which I ca... |
kernel BUG at fs/ext4/inode.c:2118!
invalid opcode: 0000 [#1] SMP
Appears to be an issue with the ext4 driver in your kernel.
Process mythbackend (pid: 27841, threadinfo ffff88004262a000, task ffff88007fb83330)
mythbackend is triggering it.
[<ffffffff811731df>] mpage_da_map_and_submit+0x2c6/0x2dc
[<ffffffff8117390a>... | What does this Linux kernel trace mean? |
1,354,054,247,000 |
We have strace to trace programs, ltrace for dynamic libraries, and others.
Is there any equivalent for kernel objects, as in tracing just like strace but for a specific .ko?
Thanks
|
You can use Ftrace. Ftrace is a tracing utility built directly into the Linux kernel. Checkout here for usage.
| Trace kernel object calls |
1,354,054,247,000 |
I am following bcc Tutorial and trying to execute the trace-bpfcc command: sudo trace-bpfcc 'sys_execve "%s", arg1'
The command fails with an error:
cannot attach kprobe, probe entry may not exist Failed to attach BPF program b'probe_sys_execve_1' to kprobe b'sys_execve'
While searching the web, I found that such an e... |
You found the correct symbol yourself: __x64_sys_execve, you want to use the same when running the command:
$ sudo trace-bpfcc '__x64_sys_execve "%s", arg1'
There is no function called simply __sys_execve in your kernel and you have to match the exact symbol for BCC to find the relevant function.
| 'cannot attach kprobe, probe entry may not exist' when execute trace-bpfcc |
1,354,054,247,000 |
I want to trace a running multi-threaded process's library calls. As of 5 November 2012, there's only one way to get ltrace to fully support tracing multi-threaded processes: you must check out and compile an ltrace 0.7.0 prerelease. So I've decided to use latrace instead. But, looking at the latrace documentation, I... |
It's impossible to attach latrace to a running process. The article "Using latrace" in the MeeGo 1.2 developer documentation makes it clear:
You must restart the process with latrace for the tracing to work.
Someone should send a feature request to the latrace mailing list.
| Is there any way to attach latrace to an already-running process? |
1,354,054,247,000 |
I'm trying to generate FTrace files inside an Android environment, using:
root@adroid:# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
root@adroid:# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# cat /sys/kernel/debug/tracing/trace > mytracefile.txt
root@adroid:# echo 0 > /sys/kernel... |
Apparently this issue has nothing to do with Android. We have tested with our custom Linux version and we have still the same problem: FTrace produces milliseconds precision while other tools are able to produce microseconds precision. Maybe a FTrace module version problem?
Regards,
| How to increase ftrace precision to microseconds? |
1,354,054,247,000 |
I'm quite new to Linux and I have not really a clue on how to do this.
I've got a directory and I'd like to monitor (output to shell) when a file inside that directory get's a file lock and when it is released.
It would be okay to know as well other things, like when a file is created and similar, but I'm mainly inter... |
I haven't checked that you will get what you want with it, but the first thing I'd try is the audit subsystem. Make sure that the auditd daemon is started, then use auditctl to configure what you want to log. For ordinary filesystem accesses, you would do
auditctl -w /path/to/directory
auditctl -a exit,always -S fnctl... | How to trace file locks (per directory) |
1,354,054,247,000 |
I'm learning linux kernel debugging and dmesg is the tool that output kernel debug log:
...
[ 2.988000] Trace:
[ 2.988000] [<ffffffff80942810>] __warn+0x160/0x190
[ 2.988000] [<ffffffff8111ae9c>] dwc3_probe+0xc1c/0x1e60
[ 2.988000] [<ffffffff8111ae9c>] dwc3_probe+0xc1c/0x1e60
[ 2.988000] [<ffffffff80fe... |
From this Stack Overflow answer:
[10991.880408] EIP: 0060:[<c06969d4>] EFLAGS: 00210246 CPU: 0
[10991.880411] EIP is at iret_exc+0x7d0/0xa59
That gives you the faulting instruction pointer, both directly and in symbol+offset form. The part after the slash is the size of the function.
Assuming a similar format, ffff... | How to understand Trace from dmesg? |
1,354,054,247,000 |
nsswitch.conf file always corrupts somehow. I do restore from my backup every time it corrupt.
When this file corrupts, its time stamp is changing. Now I wonder if there is a way to track that file ? I'd like to know which process or maybe user cause that corruption. Is there a way to do that ?
|
You could either set up auditing or use DTrace. There are various examples how to use it to monitor file access on the interwebs, for example here.
| How to track file change |
1,354,054,247,000 |
I just had a weird system freeze that I resolved using alt-sysrq-e. Here's my dmesg: https://gist.github.com/1609263
I was wondering whether it might be some kind of deadlock in the reiserfs3 code since it's mentioned so many times (and in nearly all the call traces)? Or would it look the same with any other file syst... |
I ran a Slackware system for 8 years using ReiserFS v3 as the main filesystem. I don't think I ever had a problem until the disk started having hardware problems. I looked at your messages, and although the problem appears to come from filesystem code, it also looks like ext3 messages are mixed in there.
Personally, I... | Is this task freeze related to ReiserFS (v3)? (or: is ReiserFS getting so old that it should be actively replaced?) |
1,354,054,247,000 |
I have installed gdb and added -g option to my compilation command, but when I try (gdb) s or (gdb) n it says:
The program is not being run.
It only works when I try (gdb) r and goes and stops where my program stops because of it's error(that I could see this without gdb in command line).
How should I trace line-b... |
You need to define a breakpoint, for example
break main
Then
run
and gdb will start your program and stop when it enters main.
| How to trace line by line by "gdb" C/C++ code? [closed] |
1,354,054,247,000 |
Could anyone give some insight on what these warnings mean in the below dmesg log? Do they mean that the atl1c module is failing to load completely or merely a warning?
Any information that helps understanding the log better would be appreciated.
Thank you.
[Wed Apr 4 19:51:54 2018] ------------[ cut here ]----------... |
This log is a warning from the kernel indicating there's probably a bug somewhere in the kernel code.
It's telling you that something is trying to free IRQ 18, even though it's already been freed before. As you have this repeatedly, it suggests something is trying to free it again and again.
The Comm: field shows it's... | Understanding dmesg warning |
1,354,054,247,000 |
I have the following in a script:
#!/bin/bash
logFile='script.log'
echo -n > $logFile
log="tee -a $logFile"
set -x
scp ... user@host:...
ssh user@host "
echo '...message...'
" 2>&1 | $log
{ set +x ;} 2> /dev/null # avoids trace output of '++ set +x'
The output is:
++ ssh user@host '
echo '\''> ...message...'... |
You may enable tracing for the appropriate command only, instead of doing it for the whole pipeline. Each command in a multi-command pipeline runs in its own subshell execution environment (except for the last one, in Bash, when the lastpipe option is in effect) and different set options can be applied to each of them... | Avoid printing of 'tee' trace line |
1,354,054,247,000 |
When setting up the function_graph tracer in Linux (Ubuntu 18), the trace that is stored at /sys/kernel/debug/tracing/trace only stores a couple of seconds before overwriting itself.
As the period might be variable, I cannot be saving it with for example
cat /sys/kernel/debug/tracing/trace >> total_trace
Because it mi... |
From ftrace documentation:
trace_pipe:
The output is the same as the "trace" file but this
file is meant to be streamed with live tracing.
Reads from this file will block until new data is
retrieved. Unlike the "trace" file, this file is a
consumer. This means reading from this file causes
sequential reads to disp... | /sys/kernel/debug/tracing/trace overwrites itself after a few seconds. How can I collect it without duplicates? |
1,302,229,948,000 |
Recently I accidentally did rm on a set of files and it got me thinking where exactly these files end up?
That is to say, when working with a GUI, deleted files go to the Trash. What's the equivalent for rm and is there a way of undoing an rm command?
|
Nowhere, gone, vanished. Well, more specifically, the file gets unlinked. The data is still sitting there on disk, but the link to it is removed. It used to be possible to retrieve the data, but nowadays the metadata is cleared and nothing's recoverable.
There is no Trash can for rm, nor should there be. If you need... | Where do files go when the rm command is issued? |
1,302,229,948,000 |
I have a DNS-321 NAS drive which apparently runs Linux, so I logged in via ssh and I see .Trash-500 and .Trash-1000 directories. I realize that they're for trash, but why do I need two? Inside of them I see expunged, files, and info directories -- what are those for?
|
You can find the answers in the The FreeDesktop.org Trash specification:
Some excerpts:
$topdir/.Trash-$uid directory is to be used as the user's trash directory for this device/partition. $uid is the user's numeric identifier.
The $trash/files directory contains the files and directories that were trashed.
The $tras... | What are the .Trash-500 and .Trash-1000 directories? |
1,302,229,948,000 |
I have a couple of Samba shares on my NAS running Debian Squeeze which I access through Windows 7. Deleting any of the files from Windows will completely delete the files from the NAS server.
Is there anyway to have a similar feature installed like the Trash/Recycle Bin? It would be nice if there even was a similar co... |
I think you're looking for the vfs_recycle module to Samba.
vfs_recycle - Samba VFS recycle bin | samba.org
In your smb.conf file for a given share:
[share]
Path = /data/share
vfs objects = recycle
recycle:repository = .recycle
recycle:keeptree = yes
recycle:versions = yes
| How can I have a Trash/Recycle Bin for my Samba shares? |
1,302,229,948,000 |
From what I gather, the idea of a "trash can" is of Windows descent, and was to make a user's life easier. However, when I go to delete a file, I don't hit delete unless I know I don't need it and will never need it ever again. Period. I'm currently running OpenSuse and the trash can is a confusing "feature" (as I can... |
Under KDE you can hit shift+del to directly delete selected files (or directories). Or you can press shift while chosing 'move to trash ...' in the context menu, which has the same effect.
IIRC this also works under Windows.
Probably there is some trash-properties dialog under KDE to globally disable the trash feature... | How to disable the trash can in KDE |
1,302,229,948,000 |
I have a 32 GB USB flash drive. When deleting files from the drive where the drive is plugged into a Ubuntu 16 laptop, it creates a folder called '.Trash-1000'
This .Trash-1000 folder contains two folders which are 'file' and 'info' where file contains the files I have deleted and info contains metadata about those fi... |
Have a look at this article.
According to the article, Ubuntu will create such folders when a file is deleted from a USB drive. Presumably this would allow a file to be restored if you accidentally deleted it.
It contains the following solution:
Don't use the delete button only (Otherwise the .Trash-1000 folder will ... | How to disable creation of .Trash-1000 folder? |
1,302,229,948,000 |
I've got PCManFM and Xfe as graphical file managers in my Arch Linux with Openbox.
When I click on the Trash link in PCManFM I get an error saying "Operation not supported".
Question: Where do PCManFM and xfe put files you sent to the Trash? Thanks.
|
You need to install gvfs to get PCManFM's Trash Can to work.
It stores the files in the FreeDesktop standard location: ~/.local/share/Trash/files
| Where is the trash directory for PCManFM and xfe? |
1,302,229,948,000 |
I use trash-put to trash files from command line. Recently, I had aliased my rm command to trash-put so that I don't accidentally delete something important.
However, what happened now was that I had to delete some files from my /var/log folder to free up some space on the / filesystem. I did this using sudo:
sudo r... |
Those files you removed may actually still be opened by another process. In that case the file space will become available when that process closes it's handle to the file.
You can lookup these files with lsof:
lsof |grep "var/log"|grep deleted
| Where is the trash can for root partition? |
1,302,229,948,000 |
It looks like I can get to the waste-basket through nautilus, but when I look at the location given by properties, I see "trash:///".
But I can't "cd trash:///". Where is the waste-basket? And in general, if I can find a file in nautilus, how do I get there from terminal? I've had some similar issues in the past with ... |
trash:// is a protocol, not a location.
A post on AskUbuntu says it should be in ~/.local/share/Trash. Try there.
| How to find Nautilus wastebasket in the file system |
1,302,229,948,000 |
I am using RHEL8, and I see the directory - ~/.local/share/Trash/files
And there were so many files in it. Looking at the name and files present there it gave me an intuition that it is similar to recycle bin of Windows OSes.
Just tried playing around with it, and appeared like the files deleted through File manager o... |
This is used by programs which comply with the FreeDesktop.org Trash specification. rm doesn’t follow this specification, but many current desktop environments do: instead of deleting files outright, they move them to the appropriate trash directory, thus allowing them to be “undeleted” if necessary.
On the command-li... | Is ~/.local/share/Trash/files used by GNOME only for deleted files and not by rm command? |
1,302,229,948,000 |
So here is my problem I have a pretty strange file that I can't get out of my computer.
I tried pretty much everything. First I used software like CleanMyMac, TrashIt, CCleaner etc... None of them was able to do anything.
I tried to throw it to the trash and "secure trash it". It did not complete, so I finally aborte... |
Move them to /tmp and restart (Or empty /tmp in any other way). I've had this problem before and it's been to only way for me to fix it.
Before doing this you should investigate into why they aren't deleted but use it as a last resort. There are no dangers to doing this but I recommend trying to learn why they aren't... | Unable to delete a file whatever I do |
1,302,229,948,000 |
So, I am busy writing myself a program to move and restore items from my trash (recycle bin), currently I can move it to the trash, but if I try to restore it from the trash using a file manager, it fails.
The trash directory is located at ~/.local/share/Trash and it has 2 folders inside it, files/ to store the files ... |
So, the reason I couldn't restore it was simple, in this link https://specifications.freedesktop.org/trash-spec/trashspec-latest.html (thanks Abdullah!), it specifies under Contents of a trash directory that
When trashing a file or directory, the implementation MUST create the corresponding file in $trash/info first.... | How does the trash directory work? |
1,302,229,948,000 |
I have a HDD which I mount on /mnt/sda1 at startup (in /etc/fstab)
Whenever I want to send a file to the trash in pcmanfm, I get the following message :
Some files cannot be moved to trash can because the underlying file
systems don't support this operation. Do you want to delete them
instead?
The owner of /mnt... |
This is a bit late, but I ran into the same issue. As it turns out, you have to disable the 'Erase files on removable media instead of "trash can" creation' preference. Apparently PCManFM sees any drives with an unmount button as removable media. Once that's done, sending files to trash works as expected.
| pcmanfm doesn't send files to trash on external drive |
1,302,229,948,000 |
Installation by steps:
RHEL minimal (prompt only & internet connection)
X Window system
epel-release
Xfce (+some plugins)
After all I can't find Trash folder. I guess I forgot to install something, but I can't guess the package name to enable Trash mechanism.
So the question is: How to enable Trash folder mechanism ... |
OK. I figured out myself: its necessary to install package gvfs - and trash returns back.
So if you want to remove trash from thunar Xfce (or caja Mate) - you should remove that package or it's better to remove only properties file, because gvfs affects not only trash:
/usr/share/gvfs/mounts/trash.mount
GNOME Virtua... | Missing Trash mechanism in Xfce after manual RHEL installation |
1,302,229,948,000 |
In GNOME 3.18 Settings > Privacy > Purge Trash & Temporary Files, one can configure the desktop environment to automatically empty Trash "after 30 days".
The description here isn't very clear. Is "30 days" supposed to be 30 days being in the Trash, 30 days after last opening/changing the file, or would all files be d... |
According to my tests it should be equivalent to
empty trash contents every 30 days
This is what I did:
At 1:45 PM I cleared the trash and set the privacy options to purge after 1 hour and rebooted the machine, just to be sure. I then deleted two (several months old) files and executed a script that creates a file an... | According to what does GNOME purge the trash "30 days later"? |
1,302,229,948,000 |
I'm currently trying to able the Trash feature in a NTFS partition mounted automatically on boot. To do that I'm using the permissions option in my fstab:
UUID=1CACB8ABACB88136 /media/FILES ntfs defaults,permissions,relatime 0 0
then I changed the permissions:
sudo chown :users -R /media/FILES/
sudo chmod g+rwx -R /m... |
Hey guys I've found the solution, removing my old .Trash folder that was there but wasn't working:
sudo rm -rf /media/FILES/.Trash-1000
worked like a charm, I'm now able to move to Trash from nautilus. And I'm pretty sure that If I create a new user he will be able to have its own trash too.
| How can I enable Trash feature in a NTFS partition with permissions? |
1,302,229,948,000 |
I am using Fedora 14 (Laughlin) with GNOME 2.32.0. I have gconf-editor installed. In gconf-editor apps->nautilus->preference confirm_trash is enabled i.e., checked, also in nautilus file browser, home folder, Edit->Preference->Behaviour "Ask before emptying the Trash or deleting files" is checked. But I am not getting... |
Moving a file to Trash does not delete the file - it simply stores it in a folder named "Trash" - you can retrieve files moved there so you don't get a prompt checking if you want to delete them when moving them there (as you are simply storing them somewhere else in the filesystem, not deleting them).
By selecting "A... | Move to trash confirm box |
1,302,229,948,000 |
I can (redirect) textual output to /dev/null in order to get rid of it. This is quite handy because this way I can easily enable/disable it in my bash code.
Now I have a script that processes files, and after it is done with them, moves them to another destination. An simple example would look like this:
source_dir=so... |
There is no such place for a fairly straightforward reason: there isn't any use for one. There is no situation I can think of where you can use mv globally but not rm. So while /dev/null exists because it meets a need, /dir/garbage does not because it would not.
Of course, you could say there is a need in this situa... | /dev/null-like automatic trash directory for file moves? |
1,302,229,948,000 |
TL;DR: custom partitions and trash is not showing on Thunar via AwesomeVM.
XFCE:
Awesome:
My fstab is:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks a... |
Finally I found the reason. This bug is related to lightDM starting awesome without dbus-launch. I fixed the whole problem described here by editing by hand the file /usr/share/xsessions/awesome.desktop as:
[Desktop Entry]
Name=awesome
Comment=Highly configurable framework window manager
TryExec=awesome
Exec=dbus-laun... | How to get the trash and x-gvfs-show partitions on Thunar via AwesomeVM? |
1,302,229,948,000 |
I am running Crunchbang, a Debian variant with OpenBox WM. I have deleted a large number of files via browsing in thunar file manager and pressing del key. They disappear from view. I then go to ~/.local/share/Trash/files/ and delete them there too. The filesystem still doesn't report the freed space though.
df -h
Fil... |
I once had a similar issue trying to track down what was taking up space on my root partition but not being reported by Baobab, a disk usage analyzer. In the end I found the files in my the trash folder of the root user, /root/.local/share/Trash. The reason Baobab and other utilities wouldn't show these files is becau... | Deleted files from home, deleted them from .local/share/Trash/files, System doesn't report back free space |
1,302,229,948,000 |
From KDE I use only dolphin.
I've pulled out second hdd for a couple of days (also changed fstab). Now I put it back and dolphin won't "see" /hdd2/.Trash-1000/ and if I delete file /hdd2/file1 it moves to ~/.local/share/Trash/ but should move to /hdd2/.Trash-1000/
How do I point dolphin to use right trash-dir?
|
Turns out .Trash-uid has to be with 700 permissions. Strangely, but it won't work with 777.
| KDE-dolphin trashcan on second HDD |
1,302,229,948,000 |
I have defined in Mutt two "trash" macros -- one for the Trash folder (just mark as deleted and sync) and one for the remaining folders (save into Trash and sync):
folder-hook . 'macro index <delete> "s=Trash<enter><enter><sync-mailbox><change-folder>^<enter>"'
folder-hook =Trash 'macro index <delete> "<delete-message... |
I think changing delete option at the beginning of the macro to ask-no and reseting to yes at the end should do the trick.
folder-hook =Trash 'macro index <delete> "set delete=ask-no;<delete-message><sync-mailbox><change-folder>^<enter>set delete=yes"'
| Mutt: ask before deleting messages from Trash |
1,302,229,948,000 |
If I save a file (.odt,.txt, jpeg, etc) to my hdd (not ssd), move to trash, then cut /paste the files in the trash to a usb, would this hold up to the best forensic equipment trying to recover the files from my hdd afterwards?
Basically, I'm trying not to leave a trace of the file, obviously. Also, I'm thinking that ... |
On a standard file system, erasing a file is just removing references to the data and making the space that holds the data available for reuse.
When you move a file to another location on the same file system, the data stays on the same place on the disk. For the purpose of hiding things, this is a no-op.
When you mov... | If I save file to my hdd (not ssd), move 2 trash, then cut /paste from trash to usb, will this hold up to forensic analysis designed to recover files? |
1,302,229,948,000 |
I am with Linux Mint, I delete a file with caja, it is the file manager for Mate Desktop. Because caja is open as root, now the file which I delete is on the root Trash...
I try as David Yockey to say,
The First I to try to look is the File which delete rescuee.img but to say , Das Argument ist ungültig - Argument is... |
Take a look in /root/.local/share/Trash/files. I ran Caja as root, created a file in /root, deleted it, poked around a bit, and found it in that folder. I was then able to cut & paste it from there back into /root.
| How to restore file from root Trash |
1,302,229,948,000 |
I want to restore I file I deleted accidentally. I cannot go to the trash/wastebasket folder and simply restore the file, because I've no idea what the file was. I deleted it by accidentally pressing the delete key while the screen focus was on a Thunar window. (This is a particular hazard when you have a mechanical k... |
If you open Trash with Thunar, you can sort the files by "Date Modified", which is the mtime of the file while it was alive. So you can't tell what was last deleted, in case you keep a lot of files into there.
But when the file is deleted, or better moved to Trash, the ctime changes. So sorting them by ctime could hel... | How lookup deletion date of files in Trash from command line |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.