5
votes
2answers
2k views

Disk space on Fedora 12

I'm using Fedora 12 on my laptop. I have 10GB disk space and 2GB of them are free. After 2-3 days uptime the space ends and I must reboot. After rebooting I get 2GB free space back. How can I prevent ...
5
votes
2answers
226 views

How can I display the time when a command was executed in my bash prompt?

Currently my bash prompt looks like this $ echo $PS1 # \[\e[34m\][\t]\[\e[0m\] \[\e]0;\w\a\]\[\e[34m\]\u@\h: \[\e[34m\]\w\[\e[0m\]\n$ $ The problem is that \t will only display the time when the ...
5
votes
1answer
2k views

Printing (saving) the last bash input command

How can I get the last executed command from bash? I know that !!:p prints the last command, but it seems I can't use that anywhere except the bash prompt. I tried echo !!:p but it prints ...
5
votes
2answers
957 views

Why is my hostname different in Emacs?

So I changed the name of my computer recently, by editing /etc/hostname. The bash prompt is user@name, so I know it has worked. But in emacs, in the window bar it says emacs@name.tiscali.co.uk. ...
5
votes
4answers
3k views

How do I install GCC on a system with no compiler?

I've been messing around with my NAS which runs on Linux. I have root access, but there is no compiler. I seem to remember something about being able to compile on another system, but I'm not certain. ...
5
votes
2answers
2k views

GNU screen - Restore a session with splitted screen

When I restore a splitted session of screen, I've got only one print session and have to reconfigure the number of display session. Is there another way to have the original screen configuration?
4
votes
4answers
263 views

files greater than a average size of directory?

how could I find all the files and directories with size larger than or equal to the average file size of the current directory?
4
votes
2answers
64 views

BSD sed: Replace only the Nth occurrence of a pattern

Using BSD sed; How can I perform the following substitution?: Before: hello hello hello hello hello hello After: hello world hello hello hello hello In other words; how can I replace only the ...
4
votes
4answers
111 views

Extracting strings from between special characters

I have a large text file created from combining lots of html files. cat *.html > all_html_files.txt Inside the text file are specfic strings that I want to extract to another text file. For ...
4
votes
1answer
34 views

How to list all currently available compose key combinations?

Is there some way to inspect the state of X to get exactly and only a list of compose key shortcuts and what they map to, either as literal keys, for example: aa å 88 ∞ or as glyph names, for ...
4
votes
2answers
253 views

Set the bash display [while using GNU Screen utility] to not show the vim text after exit

Currently when I am not using screen utility, I am able to see the VIM content wiped out of the display when I quit VIM. However when I am using GNU Screen utility and opening a file in one of the ...
4
votes
1answer
127 views

Load aliases from .bashrc file while using sudo

I have set aliases for a few programs in the .bashrc file, and they work fine without sudo and they don't with sudo. Is there a way to get those aliases work with sudo? For example: nano text.txt ...
4
votes
1answer
96 views

NFS umount fails to find directory in /proc/mounts

When mounting an NFS share manually using mount and a path of the form <domain/ip>:<path>/<path> or <domain/ip>:/<path>/<path>, umount fails to find the path in ...
4
votes
5answers
239 views

Bash - PS1 not Updating With Proper Hostname after Hostname Change in Script

This is a copy of my post from stackoverflow; I realize I should have asked it here... I want to run a script that changes the hostname and have my bash prompt (PS1 variable) update immediately with ...
4
votes
1answer
71 views

Printing more than one field

Is there a way to print multiple fields with a single line command? I want to print $3 to $NF, I can do it like below: awk -F[:] '{print $3,$4,$5 .... $NF}' Yet it is not doable with large ...
4
votes
2answers
48 views

Tar is currently reading a 2GB file, and I deleted its only link. How do I stop it from running for an eternity?

Some more information: I was backing up a large directory with tar, only there were a couple of large files there that I didn't expect. This connection is over the network and very slow, so simply ...
4
votes
3answers
315 views

Bash - Functions in Shell Variables

I am reading this post on using functions in bash shell variables. I observe that to use shell functions, one has to export them and execute them in a child shell as follows: $ export foo='() { echo ...
4
votes
1answer
181 views

Debian stretch asks for root password in order to mount usb disks after upgrade

After apt-get upgrade && apt-get dist-upgrade, Debian Stretch started to ask for root password for external usb disks. Creating a /etc/polkit-1/localauthority/50-local.d/55-usb-mount.pkla ...
4
votes
3answers
133 views

How to append data to buffer in shell script?

I'd like to do following using shell script: (for simplicity, I use same data for INPUT. In real case, the data changes with loop label jj) #!/bin/sh for jj in `seq 100`; do cat INPUT.file ...
4
votes
0answers
131 views

allow regular users to use network namespaces

I have an architecture using network namespaces (netns). I would like to allow regular users to do some operations in these netns. I could write a script netns-exec.sh, inspired by this post, ...
4
votes
1answer
309 views

how to start a systemd service before networking starts?

I'm trying to set up a new service (under Debian Jessie) that needs to set up some mounts where the network configuration is stored and thus this service must complete before networking.service ...
4
votes
1answer
42 views

Prevent debian from hindering boot if a software-raid problem exists

I have a computer that I rarely have physical access to. All my access to that computer is done using SSH. On that computer, there's a software RAID5 using MDADM. This array contains data in one ...
4
votes
1answer
83 views

How to use awk to indent a source file based on simple rules?

How can I indent source code based on a couple of simple rules? As an example, I've used sed and ask to transform a selenium HTML source table to the following rspec like code. How could I ...
4
votes
1answer
2k views

SSE2 requirement for John The Ripper

I have a kinda problem about john in Kali x86. To make long story short, I can't allow to run john under Kali Linux 2.0 installed into LV, but as I remember I was able to run in older Kali and older ...
4
votes
2answers
219 views

How can I use Linux as a Gateway?

NOTE: If client devices (computer B in this example) want to obtain internet through the gateway computer, maybe they still need to configure nameserver resolution. This is not explained here ...
4
votes
5answers
345 views

How do I *reliably* and *simply* get the current shell interpreter name?

I'm looking for a simple and reliable way to get the name of the current shell from inside a script or a sourced file (not from the command line). I would have expected to just do $(basename ...
4
votes
1answer
235 views

Any problem assigning one variable to another in shell without using quotes? [duplicate]

This question is about assigning the entire contents of one variable to another variable. Variable is not being used (sent to echo, etc.) No parameter expansion is being done during the assignment. ...
4
votes
1answer
1k views

Scaling the desktop - kde

I've just installed OpenSuse 13.2 on my xps13. The resolution is a whopping 3200 x 1800. Which causes the text to come up tiny... Any way for me to scale this without having to lower the resolution ...
4
votes
2answers
657 views

How to permanently disable root-password prompt for recovery mode, RHEL7

Note: I asked a similar quesiton concerning version 6 of these bundles here. Note that 7 uses systemd and may have a different implementation In the rare cases that a RHEL or CentOS 7 system is ...
4
votes
1answer
273 views

“Xterm” or “xterm” in configuration file

After starting to use Arch I switched to xterm and urxvt terminal and enjoyed the flexibility of them (esp. scaleHeight resource). However, I don't understand why sometimes configs work with Xterm and ...
4
votes
1answer
231 views

rsync's relationship with special files

I'm trying to transfer some existing backups from one system to another. The older backup system seems to have managed to back up special files like /dev/hda, /dev/tty0, and /dev/null which look like ...
4
votes
10answers
567 views

How to quickly add some space in the terminal?

I often find myself scrolling back through the terminal with the mouse-wheel to see the first of many C++ template errors issued by a command. Anticipating this, I'll hold down the Return key to give ...
4
votes
2answers
185 views

Copy the files automatically to destination as soon as created

Is there any way to copy the file in Unix as soon as it is created? I have one location where files will be created in different timings.How can I copy the files automatically using shell script to ...
4
votes
4answers
843 views

Find the last occurence of a string in a given filetype in all subdirectories

I have multiple sub-directories each with different depths. I need to search for the last occurrence of a string in a specific file type (say *.out). How can I accomplish this? I have tried: grep -r ...
4
votes
2answers
75 views

How to prevent DPMS from activating when a full-screen window is open?

I am generally quite happy with DPMS screen blanking but for one (rather annoying situation): when playing a game through Wine with a gamepad the screen blanks after a while. I guess that in this case ...
4
votes
4answers
329 views

sed to delete lines using multiple search string

I have a text file, let say test1.txt, I need to remove the line containing dog and date with "29-APR-2015" Using the below command to accomplish it but it is not deleting the lines. Where as if i ...
4
votes
2answers
482 views

Why I should avoid loops in shells? [duplicate]

The following link recommends against using loops in shells. bash variables in for loop range Why is this? Here is an example loop I just happened to be looking at when I came across that answer: ...
4
votes
0answers
148 views

How do I change key bindings based on which window is focused?

I have these lines in my i3 config right now: # Play/pause, prev, next bindcode 172 exec "/opt/playerctl/bin/playerctl play-pause" bindcode 173 exec "/opt/playerctl/bin/playerctl previous" bindcode ...
4
votes
3answers
287 views

Adding vertical space after command in bash

How to add vertical space after each command in bash? Looking for a wee bit of vertical space, not a full line. 1/4 or 1/3 of the line height should do it. [edit] The space to add is only after the ...
4
votes
2answers
330 views

sed: inserting text before end of <HEAD> section

I need to insert some text into an HTML file before the end of the HEAD section. I'm trying: sed -i "s#</head>#<style> @page { prince-shrink-to-fit: auto } ...
4
votes
2answers
2k views

generic methodology to debug ordering cycles in systemd

I am aware of following thread and supposedly an answer to it. Except an answer is not an answer in generic sense. It tells what the problem was in one particular case, but not in general. My ...
4
votes
1answer
1k views

find common lines between multiple files

i have 4 files which are like file A >TCONS_00000867 >TCONS_00001442 >TCONS_00001447 >TCONS_00001528 >TCONS_00001529 ...
4
votes
1answer
493 views

Why is my systemd journal not persistent across reboots?

I'm experiencing a very weird issue with a fresh Fedora 21 image on a Linode instance. I cannot reproduce it outside of Linode. The issue is that my systemd journal is not persistent across reboots. ...
4
votes
1answer
168 views

git: show which files have changed between kernel 3.18.6 and 3.18.7

I have checked out linux kernel git repository git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git I know how to use git log, git show and similar commands to see ...
4
votes
2answers
1k views

Why should you NEVER edit the /etc/shadow file directly?

In another answer here on UNIX & Linux Stack Exchange Michael D Parker wrote, in response to someone saying that doing so was "safe", that:Usually you should NEVER edit the /etc/shadow file ...
4
votes
2answers
394 views

How to get the real name of the controlling terminal?

How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname? By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
4
votes
4answers
2k views

How can I find and replace only if a match forms a whole word?

My script is: n="y" while [ "{n}" = "y" ] if [ $n == "n" ]; then break; fi echo "n is $n" do read -p "Enter the word to find = " word read -p "Enter word to replace = " replace ...
4
votes
1answer
1k views

scanimage does not find scanner unless sudo'ed, but shows up with sane-find-scanner (Raspbian)

I have an Epson multifunction device connected to a Raspberry Pi running the latest Raspbian. As you can see in the output below, scanimage will only find my scanner if I sudo it, but sane-find ...
4
votes
3answers
314 views

Bash, insert last used argument of current command

I'm aware that you can recall the last argument of the previous command with !$ and also cycle through previous arguments with ALT + . but can you recall the last argument used for the current command ...
4
votes
1answer
776 views

Trim audio file using start and stop times

I have an FFmpeg command to trim audio: ffmpeg -ss 01:43:46 -t 00:00:44.30 -i input.mp3 output.mp3 The problem I have with this command is that option -t requires a duration (in seconds) from ...

15 30 50 per page