Tag Info

Hot answers tagged

42

This is all due to the fact that the X server is out-dated, ill-suitable for today's graphics hardware and basically all the direct video card communication is done as an extension ("patch") over the ancient bloated core. The X server provides no builtin means of synchronization between user rendering the window and the screen displaying a window, so the ...


7

When dealing with return codes "0" is a success and non-zero is failure. The syntax of a while loop is: while COMMANDS; do ...; done The while statement checks the return code of the last command in the provided list of commands. In you last example of while 0, this will attempt to execute a command called "0" and check it's return code. A literal 0 is ...


6

Screen tearing appears mostly because of two reasons - drivers that aren't there yet, and lack of vsync with certain window managers. As for drivers, both free and proprietary drivers support free-tearing compositing (nvidia and amd both). Be aware that e.g. enabling tear-free desktop in catalyst (fglrx) may cause frame drop and lags, so it is usually ...


6

Once your terminate a job with CTRL+C it is terminated and you can't tell a dead job to continue and pick up where it was. The correct term is to run a job in the background, which you can do beforehand: ./script & You can use that in combination with nohup to make the process immune to hang-ups, it will continue to run even if you log out from ...


5

If you run ps -el instead of ps -ef, you'll get an S column with the process state. My guess is that the process is in state D, which means uninterruptible wait. In other words, the process is stuck in the messier parts of a device driver, and the kernel doesn't think it's safe to kill it until the device driver lets go of it. You sometimes see this with ...


5

To illustrate the question in a simple and efficient manner, consider two scenarios: You install your favourite linux distribution on entire disk i.e. without any partitions: Suppose your system is crashed because operating system is unable to access some sectors and unable to boot. You lost some chunk of data due to bad sectors and because of that you ...


5

The shell does not expanded condition like you think. In shell, an error code 0 indicated that the command has completed successfully. Any non-zero error code indicated that there was error. For more concisely, POSIX define while loop as: The while loop shall continuously execute one compound-list as long as another compound-list has a zero exit ...


5

The "while" command isn't looking for a boolean value, it's looking for a return code of "0" which indicates successful execution of the command. So in the case the while command, a command that returns 0 is "true" and anything else is "false". Even when you're doing a comparison, Bash treats that like a command which is returning a successful error code ...


4

The rule syntax above may work on some distributions, but did not work on mine (Raspbian). Since I never found a single document that explains all the ins and outs, I wrote my own, to be found here. This is what it boils down to. 1. find out what's on ttyUSB: dmesg | grep ttyUSB 2. list all attributes of the device and pick out a unique identifier set, ...


4

I answered most questions in this thread here about the ghost vulnerability. In short no, rebooting the system isn't 'required' but because so many applications/system utilities use glibc, you will have to make sure you restart every one of them before the patch takes effect. This is why it is 'recommended' that you just restart the environment. My thread ...


4

Was changing ownership of everything to root the right thing to do? No. It is, however, the quickest way I can think of to get the system to normal state. There are plenty of process which require some directories/files be owned by their user. Examples include logs, caches, working/home directories of some processes like MySQL, LightDM, etc. ...


4

It means the process has a separate copy of the hostname and the (now mostly unused) NIS domain name, so it can set it to something else without affecting the rest of the system. The hostname is set via sethostname and is the nodename member of the struct returned by uname. The NIS domain name is set by setdomainname and is the domainname member of the ...


4

I don't think you can use environment variables, as they won't persist between script "runs". Alternatively, you could write to a temporary file in /tmp or somewhere in your home directory, then check it each time? For example, something like #!/bin/sh output=$(wget http://lon2315:8081 2>&1) pattern="connected" tempfile='/tmp/my_website_is_down' ...


4

The installation of a Unix program consists of roughly two parts. 1) Putting the files in suitable locations 2) Setting file permissions and ownerships suitably With regard to the first, the Linux File Hierarchy Standard is relevant. This is Linux specific, but largely follows historically codified Unix rules. Specifically, binaries intended to be run by ...


4

Per your bonus question, add the following line below the rsync command in the shell script I provided below. I wrote this in the comment but I'll officially add it to my answer here: find /auto/std2/nat2/B -name '*.zip' -exec sh -c 'unzip -d `dirname {}` {}' ';' This will handle unzipping all the zip files that are copied via rsync from folder ...


3

From the Select manpage: On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.) After the first timeout occurs, your timeout variable has been updated to reflect the amount of time remaining to sleep, which is 0, because it waited for the entire ...


3

For starters this should be on StackOverflow, not here. The whole concept you know from Windows with services simply does not exist on Linux. On Windows your process registers a callback that the Service Control Manager (SCM) uses to initialize and control your service. This way requests sent to the SCM pertaining to your service can be processed, such as ...


3

What you want are ssh-key pairs, these create 'trusted networks' that allow for password-less authentication: On your client (server1): [user@server1]# ssh-keygen -t rsa -b 2048 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): # Hit Enter Enter passphrase (empty for no passphrase): # Hit Enter Enter same ...


3

With bash you can do nearly what you're asking for like this: echo !echo:$ So when you do echo This is fun ls echo !echo:$ the last line outputs fun. * instead of $ produces all the arguments to the matching command; so echo This is fun ls echo !echo:* outputs This is fun again; but you might as well just do !echo in this case. This isn't ...


3

Lack of partitions is a common cause for needing recovery in the first place. A partition table is the most common / standard way to declare that the disk is in use (and thanks to various partition types, it usually also declares what exactly each partition is used for). An unpartitioned disk looks like an unused disk to many programs; installers select ...


3

DEL doesn't indicate that that process deleted /dev/zero, but that that process is using /dev/zero and the instance of /dev/zero that was being used has since been deleted. For example, if I have a command (say some-command) that uses /some/file and I do: $ some-command & $ rm /some/file $ touch /some/file Then lsof for /some/file would look like: ...


3

Just follow the command below to resolve your case execute this command to add directory mkdir -p /home/connectweb in case of need copy files from /etc/skel directory to have .bashrc and so on files change ownership of this directory chown -R connectweb:connectweb /home/connectweb if you want to increase a little bit the security change the permissions ...


3

You can test where /usr/bin/vi to lead update-alternatives --query vi Usually there is link to /usr/bin/vim.tiny To find package name you can try dpkg -S /usr/bin/vim.tiny In my system I have received vim-tiny: /usr/bin/vim.tiny So there is additional package vim-tiny.


3

This sorts .23 after .3: $ sort -h -t. -k3,3 -k4,4 sort_test.txt 10.1.1.1 10.1.1.2 192.168.1.2 10.1.1.3 192.168.1.3 192.168.1.4 10.1.1.23 192.168.1.43 192.168.1.56


3

To apply those permissions to a directory: chmod 755 directory_name To apply to all directories inside the current directory: chmod 755 */ If you want to modify all directories and subdirectories, you'll need to combine find with chmod: find . -type d -exec chmod 755 {} +


3

This is a bug. The actual root cause is somewhat deeper: systemd's reload logic is flawed. That's why you saw it only when you had actually enabled a unit (i. e. a "disabled -> enabled" transition had taken place): in this case systemd implicitly reloads the units. I'm working on fixing the bug; in the meantime, if this manifestation (spontaneous volume ...


3

Try: for f in ./*.txt; do sed -i '' -e "s/$/$(printf '\t')$f/g" "$f" done


3

Its reasonable to expect PlayOnLinux to be a little heavier than native. PlayOnLinux relies on wine, which brings in a whole layer of virtualization overhead. Steam on the otherhand is more of a grab-bag of some native games and some wine-wrappered games, so some will run smoother than others, depending on who/how it was ported. Additionally, the ...


3

You are almost there. find directory -type f -exec wc -lc {} + will get file name, line count, and character count. Strictly speaking, -c (a.k.a. --bytes) is documented as counting bytes, which is probably what you want.   There is also a -m (a.k.a. --chars) option for counting “characters”.  From the choice of the m option letter, I guess this counts ...


3

You can check /var/log/apt/history.log When you issue apt-get install, it records the command line as Commandline: record, and real packages installed as Install:



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