4
votes
1answer
1k views

Reading a filesystem from a whole disk image

I ran these commands: VBoxManage clonehd d6b9f0a5-98df-48ca-83c8-91a0809ec349 --format RAW Debian.raw sudo dd if=~/.VirtualBox/HardDisks/Debian.raw of=/dev/sda5 When I try to mount the partition, I ...
12
votes
5answers
1k views

How to de-unzip, de-tar -xvf — de-unarchive in a messy folder?

Usually, I unarchive things by $ mkdir newFolder; $ mv *.zip newFolder; $ cd newFolder; $unzip *.zip but sometimes I get lazy and just do in an arbitrary folder $ unzip *.zip so time-to-time messing ...
4
votes
1answer
286 views

How to change the forgotten root password?

I am very new to Debian linux, I forgot my root password...actually I think I know what it is because it is the same password I have for pretty much everything but in the Terminal in tell me "Sorry, ...
3
votes
2answers
1k views

Installation on debian 5 32-bit without being a root

I am new to Linux and I am trying to install Skype and Google Chrome on my desktop. It runs Debian 5 32-bit. I downloaded the packages from the web but I have no idea how to install them. I have ...
3
votes
1answer
123 views

How to ensure that string interpolated into `sed` substitution escapes all metachars

I have a script that reads a text stream and generates a file of sed commands that is later run with sed -f. The generated sed commands are like: ...
1
vote
1answer
863 views

Pxeboot: Client not getting ip address from the DHCP Server

I am Working on Pxeboot. I have a Ubuntu system as KVM and in that system I installed Virtual machine manager. I also installed Ubuntu in the virtual machine. Before I start my virtual machine, I ...
73
votes
1answer
87k views

How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the ...
55
votes
3answers
30k views

What do the flags in /proc/cpuinfo mean?

How can I tell whether my processor has a particular feature? (64-bit instruction set, hardware-assisted virtualization, cryptographic accelerators, etc.) I know that the file /proc/cpuinfo contains ...
58
votes
9answers
2k views

Remember a half-typed command while I check something

I often find myself in the following position: I've started typing a long command at the bash prompt, but half-way through I find out I need to check something with another command. This is a problem ...
70
votes
6answers
19k views

Why hard links not allowed to directories in UNIX/Linux

I read in text books that UNIX/Linux doesn't allows hard links to directories but soft links do. Is it because, when we have cycles and if we create hardlinks, and after some time we delete the ...
23
votes
5answers
15k views

SSH to decrypt encrypted LVM during headless server boot?

When I installed Ubuntu 10.04 and, now, 10.10, I was offered the option of enabling "encrypted LVM" for my hard drive. After choosing that option, I am prompted for my password during boot to decrypt ...
23
votes
4answers
1k views

What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)?

I am trying to figure out how a tty works1 (the work-flow and responsibilities of each elements). I have read several interesting articles about it, but there are still some blurry areas. This is ...
38
votes
6answers
6k views

The result of ls * , ls ** and ls ***

I know using the command ls will list all the directories. But what does the ls * command do ? I used it and it just lists the directories. Is the star in front of ls means how deep it can list the ...
30
votes
9answers
9k views

A tool for automatically applying RandR configuration when external display is plugged in

is there a tool which enables one to: remember current RandR configuration (position, orientation, resolution etc) on per-monitor basis, automatically apply last known good configuration as soon as ...
23
votes
4answers
7k views

Measuring RAM usage of a program

time is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can measure the max RAM usage of the program and any children. ...
20
votes
2answers
6k views

How do I tell I'm running in a chroot?

I have a unix installation that's supposed to be usable both as a chroot and as a standalone system. If it's running as a chroot, I don't want to run any service (cron, inetd, and so on), because they ...
15
votes
3answers
3k views

Reattach to lost X11 session

I'm using X11 forwarding over ssh to run Linux apps on my Windows box, and when the network drops it loses everything that was running. Is there anything similar to screen for X11?
18
votes
7answers
22k views

Which GUI diff viewer would you recommend, with Copy-to-Left/Right functionality?

I've hardly ever used anything other than Meld. Can you recommend anything else? It would be extra nice if you give a reason for your recommendation (as a Comment). [note] I want an alternative ...
14
votes
1answer
5k views

How can I configure a reverse SSH connection to the connecting computer?

I'm going to be deploying a number of machines in the near future which will be behind routers. It won't be feasible to set up dynamic DNS on each router and port forwarding, so is there a way I can ...
13
votes
5answers
12k views

Show only stderr on screen but write both stdout and stderr to file

How can I use BASH magic to achieve this? I want to only see stderr output on the screen, but I want both stdout and stderr to be written to a file. Clarification: I want both stdout and stderr to ...
12
votes
5answers
45k views

How can I read line by line from a variable in bash?

I have a variable which contains multiline output of a command. What's the most effecient way to read the output line by line from the variable? For example: jobs="$(jobs)" if [ "$jobs" ]; then ...
22
votes
8answers
21k views

Different ways to execute a shell script

There a several ways to execute a script, the ones I know are: /path/to/script # using the path (absolute or relative) . script # using the . (dot) source script # using the `source` command ...
22
votes
1answer
6k views

What does adduser do that useradd doesn't?

In addition to the more widespread useradd, Debian based systems also contain an additional adduser command which provides a higher level interface for adding users and some related tasks. There are ...
19
votes
3answers
7k views

How can I use two bash commands in -exec of find command?

Is it possible to use 2 commands in the -exec part of find command ? I've tried something like: find . -name "*" -exec chgrp -v new_group {} ; chmod -v 770 {} \; and I get: find: missing ...
16
votes
5answers
29k views

Script to monitor folder for new files?

How do I detect new files in a folder with a bash script? I would like to process the files as soon as they are created in the folder. Is this possible to do so or do I have to schedule a script with ...
11
votes
3answers
9k views

What is stored in /dev/pts files and can we open them?

I am curious to know that what is stored in /dev/pts/ files. Can we open these files? According to my knowledge, /dev/pts files are created for ssh or telnet sessions.
15
votes
5answers
941 views

How to compile and install programs from source

This is an issue that really limits my enjoyment of Linux. If the application isn't on a repository or if it doesn't have an installer script, then I really struggle where and how to install an ...
19
votes
5answers
4k views

Why is echo a shell built in command?

$ which echo echo: shell built-in command. $ which ls /bin/ls $ which cat /bin/cat Why is echo not an independent utility like ls, ps, cat etc? Why is it shell specific? Any good reasons?
15
votes
2answers
7k views

/proc/PID/fd/X link number

In Linux, in /proc/PID/fd/X, the links for file descriptors that are pipes or sockets have a number, like: l-wx------ 1 user user 64 Mar 24 00:05 1 -> pipe:[6839] l-wx------ 1 user user 64 Mar 24 ...
32
votes
1answer
5k views

How to do a `tail -f` of log rotated files?

On a long running system I usually have a terminal with $ tail -f /var/log/kern.log or something like this open. But from time to time I have to restart such command because no new messages are ...
29
votes
2answers
27k views

How do I do a ls and then sort the results by date created?

In what order are the dated ordered by? Certainly not alphanumeric order. ls -lt sorts by modification time. But I need creation time.
20
votes
7answers
3k views

how to glob every hidden file except current and parent directory [duplicate]

I want to glob every hidden file and directory, but not the current (.) and parent directory (..). I am using bash. Observe current behaviour: $ ls -a . .. ...a ...aa ..a ..aa .a .aa .aaa ...
3
votes
6answers
1k views

Common multiple SSH connections file handling issue

often I have to download a file that isn't directly accessable via the first SSH connection. For example I'm on a Windows machine and I want to access another machine that is only accessable from lan. ...
22
votes
4answers
4k views

Single dashes `-` for single-character options, but double dashes `--` for words?

Where did the convention of using single dashes for letters and doubles dashes for words come from and why is continued to be used? For example if I type in ls --help, you see: -a, --all ...
14
votes
3answers
7k views

How to list files that were changed in a certain range of time?

How can I list recursively all files that were changed between 22.12.2011 and 24.12.2011?
13
votes
10answers
2k views

Detect init system using the shell

This may have more to do with detecting operating systems, but I specifically need the init system currently in use on the system. Fedora 15 now uses systemd, Ubuntu uses Upstart, while others use ...
10
votes
2answers
509 views

Order of redirections

I don't quite understand how the computer reads this command. cat file1 file2 1> file.txt 2>&1 If I understand, 2>&1 simply redirect Standard Error to Standard Output. By that ...
9
votes
1answer
312 views

Why my ethernet interface is called enp0s10 instead of eth0?

Just that, when I run ifconfig -a I only get lo and enp0s10 interfaces, not the classical eth0 What does enp0s10 means? Why is there no eth0?
6
votes
6answers
671 views

How can I reproduce commands run on one machine on another machine?

I would like to install some software on a linux-machine that I have run in VirtualBox. Then I would like to do the same thing on a linux-VPS. I think that I can save all commands that I run using ...
5
votes
3answers
5k views

Moved bin and other folders! How to get them back?

I accidentally moved all folders from root to a subfolder. (/bin, /etc, /home, /lib, /usr... all moved) The only ones that were not moved, since they were in use, are /bak, /boot, /dev, /proc, /sys. ...
9
votes
3answers
242 views

How to define similar bash function at once

I have these functions in ~/.bashrc: function guard() { if [ -e 'Gemfile' ]; then bundle exec guard "$@" else command guard "$@" fi } function rspec() { if [ -e 'Gemfile' ]; ...
8
votes
1answer
371 views

Reliable way to jail child processes using `nsenter:`

I know that Linux namespaces, among many other things, can be leveraged to handle restricting and jailing child processes securely without any chance of their being zombied and dumped on init. But I'm ...
8
votes
6answers
8k views

Shell script for moving oldest files?

How do I write a script for moving just the 20 oldest files from one folder to another? Is there a way to grab the oldest files in a folder?
7
votes
4answers
4k views

Make cd automatically ls

I find that I often do the following: %> cd bla/bla %> ls I would like it that whenever I cd into a directory it automatically does an ls. I fiddled with my .bashrc for a while, but couldn't ...
25
votes
3answers
7k views

Are there any side effects when two distros share a swap partition?

In order to save disk space, I want to have two OS installations share a single swap partition (a dual-boot). Is this a good idea?
12
votes
2answers
853 views

Manipulating X key and pointer grabs on the command line

What command line tools exist to list and manage X server grabs? (That's grab as in key and pointer grabs, i.e. restricting the use of a particular key or mouse button to a particular application, or ...
10
votes
3answers
12k views

Installing a .deb package in home directory

Is it possible to install a .deb package completely under my home directory at debian?
9
votes
5answers
1k views

Why do I need to quote variable for if, but not for echo?

I've read that you need double quotes for expanding variables, e.g. if [ -n "$test" ]; then echo '$test ok'; else echo '$test null'; fi will work as expected, while if [ -n $test ]; then echo ...
9
votes
3answers
10k views

How do I know that my CPU supports 64bit operating systems under Linux?

How can I find out that my CPU supports 64bit operating systems under Linux, e.g.: Ubuntu, Fedora?
7
votes
3answers
28k views

Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code: set timeout 30 /usr/bin/ssh -p 8484 ...

15 30 50 per page