Tag Info

Hot answers tagged

72

&& is a logical operator. ; is simple sequencing. In cmd1 && cmd2, cmd2 will only be run if cmd1 exits with a successful return code. Whereas in cmd1; cmd2, cmd2 will run regardless of the exit status of cmd1 (assuming you haven't set your shell to exit on all failure in your script or something). On a related note, with cmd1 || cmd2, ...


59

Linux is a kernel, Debian is a distribution of that kernel and a bunch of software to actually interact with the system. I can now take Debian and change the logo on the boot screen to my own logo and then my distribution is based on Debian (in a very primitive way). Usually, the adjustments that are made in a derived distribution are more substantial. ...


48

Call the command like so: mkdir -- -a The -- means that the options end after that, so the -a gets interpreted literally and not as an option to mkdir. You will find this syntax not only in mkdir, but any POSIX-compliant utility except for echo and test. From the specification: The argument -- should be accepted as a delimiter indicating the end of ...


44

Use rm \\ (escape the backslash with another backslash). Note that this also works similarily, for directories named \ (using either rmdir, or rm with the -r flag). Example: >mkdir demo >cd demo >touch \\ >ls -l total 0 -rw------- 1 hennes users 0 Jul 29 20:25 \ >rm \\ >ls -l total 0


34

You may want to use the truncate command: truncate --size=1G test.txt SIZE can be specified as bytes, KB, K, MB, M, etc. I assume you can calculate the desired size by hand; if not, you could probably use the stat command to get information about the file's current size.


31

Linux is a kernel — a (complex) piece of software which works with the hardware and exports a certain Application Programming Interface (API), and binary conventions on how to precisely use it (Application Binary Interface, ABI) available to the "user-space" applications. Debian, RedHat and others are operating systems — complete software ...


29

Syntax command1 && command2 command2 is executed if, and only if, command1 returns an exit status of zero (true). In other words, run command1 and if it is successfull, then run command2. command1 ; command2 Both command1 and command2 will be executed regardless. The semicolon allows you to type many commands on one line. Related: command1 || ...


22

For Unity (shipped by default since the Ubuntu12), Gnome, LXDE, Cinnamon and MATE, the Ctrl+Alt+T keyboard shortcut will work if you are already logged in. If you are using Xfce (Xubuntu), however, it would be Super+T. (Note that Super is the Windows key) And as far as I am aware, in KDE, while it is also Ctrl+Alt+T, for some reason, there are issues with ...


20

The simplest way that should work with any reasonable program is to use a relative path name in front of the -, e.g. mkdir ./-a will create a directory called -a in the current working directory. The most common example of using this "trick" is when you want to remove a file which begins with a dash, so you can do rm ./-a.


17

perl -we 'open( FILE, "< ./test.txt" ) && truncate( FILE, 8 ) && close(FILE);' opens the file for reading. However, to truncate the file you need to modify it, so a read-only file handle isn't going to work. You need to use the "modify" mode ("+>"). As a side issue, it always amazes me when people let system calls fail silently and ...


11

You can also unlink by referencing the inode of a file linus ~/test $ touch \\ linus ~/test $ ls -li total 0 15204561 -rw-r--r-- 1 pat sudo 0 Jul 29 23:03 \ linus ~/test $ find . -inum 15204561 -exec rm -v {} \; removed `./\\' linus ~/test $ ls -li total 0 linus ~/test $


10

You can use dd to do a disk dump, i.e. dumping the disk byte-by-byte. Feed it to md5sum afterwards to compute the checksum. dd if=/dev/sdb1 bs=1M count=950 | md5sum where if means where to read from; /dev/sdb1 is your USB device; bs indicates Block Size or how much dd is going to read at a time and 1M means 1024*1024 bytes; count means how many blocks to ...


9

When using pipes, you want to consider the order of operations before fashioning your pipeline. You'll also want to have a good understanding of what each command does. For clarification: /etc/passwd and /etc/group are not directories, but files. You're on the right track using ls for directories, but in this case it is not needed. To get you started, here ...


9

From Bash FAQ: E10) Why does `cd //' leave $PWD as `//'? POSIX.2, in its description of `cd', says that *three* or more leading slashes may be replaced with a single slash when canonicalizing the current working directory. This is, I presume, for historical compatibility. Certain versions of Unix, and early network file systems, used paths of the form ...


8

Sendmail requires that the result of "hostname" be a fully qualified domain name to start cleanly. Set the hostname to something like piotr-probook.localdomain and update /etc/hosts. /etc/hosts 127.0.0.1 piotr-probook.localdomain piotr-probook localdev localhost


8

Red Hat, Debian, etc. are all distributions ("distros") of Linux. Keep in mind that Linux is technically only the kernel, which is a single part of a working and useful system. You'll need basic utilities, decisions regarding where things live in the system, a mechanism for installing and updating software, and conventions/standards (such as the ...


7

With Linux there are distributions or distros. Literally hundreds of them. Linux is Open source, so anyone (or any group or company) can modify any part of the OS that they wish. This is why some versions have different installers (.deb vs. RPM or just tar) and different commands (apt-get vs. yum). Most distros choose a target use or specific uses and ...


7

You might be interested in sshfs. With that package you can mount a remote directory via SSH and use it like a local one: sshfs user@ubuntu:/var/log /mnt/ubuntu_logs It works completely transparent and you can use in principle every program which is installed on your local machine. In order to use sshfs you'll need also a package that provides a ...


7

Barring political reasons (or [usually silly] technical reasons), any piece of open-source software available for any given Linux distribution can work with any other Linux distribution available. Packaging a piece of software, however, has a non-zero cost. Not only must the files be placed in the appropriate locations for the distribution, but there are ...


7

There are two ways to do this: Apt-get specific: $man apt-get [...] -y, --yes, --assume-yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs ...


6

My info did not show up in XOrg.log. But I figured out that I could get the info from the DRM (Direct Rendering Manager) subcomponent of the linux kernel, which is exposed in sysfs. So I did the following: root@dark:~# ls /sys/class/drm/ card0 card0-DP-2 card0-eDP-1 card0-HDMI-A-2 card0-VGA-1 version card0-DP-1 card0-DP-3 card0-HDMI-A-1 ...


6

First, useradd creates a new user. As you (iain) already exist, you want to call usermod instead. So that would be: sudo usermod -aG www-data iain addgroup www-data (note the -a that will add you to that group, and keep your membership to other groups. Forget it and you will belong to the www-data group only.) Second, you don't want apache to have full ...


6

I can see no reason why not. This article gives you a great introduction to dual booting Ubuntu. If you simply want to run it under a Virtual Machine (e.g. still be booted into Windows and have Ubuntu running under it at the same time) I'd look into Virtual Box. here is a good tutorial on doing just that.


5

This is one of those questions that is kind of multi-level. Some of them are basic Linux Operator 101 issues that you need to familarize yourself with in order to manage this system. First Issue is that you must understand permissions as they apply in the Linux file system. There are five pertinent attributes that are applicable to both files and ...


5

First of all, you are talking about files, not directories. Also, the ls is irrelevant. All you need to do is cat /etc/passwd/ /etc/group | less catsimply prints the contents of the files you give it, giving it two files will cause it to output the contents of one after the other. less is a pager, a program that allows you to read multi-line data one ...


5

Both of those methods a mostly similar effect. Since the default sudoers file on Debian includes the line: %sudo ALL=(ALL:ALL) ALL Granting that permission to all members of the sudo group. A couple of differences that may matter to you. When the modification takes effect. If you explicitly add the user to the sudoers file that user will be able to ...


5

I had the same problem. I downngraded my version to 6.0 (6.1 might work) but read this thread: https://communities.vmware.com/message/2313778#2313778 scroll down to the official answer. The simplest maybe to downgrade back to 6.0.1 tools for now until this gets addressed in the next release of tools. Or as another user stated earlier in the thread, ...


5

Consider simply using a SSH key to log in as root (PermitRootLogin without-password). Each key can be limited to specific source addresses using the from="1.2.3.4,8.9.0.0/24,::1" option in authorized_keys. The manpage, right under "AllowUsers", does say: The allow/deny directives are processed in the following order: DenyUsers, AllowUsers, DenyGroups, ...


5

I encountered this when trying to reboot with sudo reboot now. sudo shutdown now also failed. In both cases, the system switched to single-user mode and stalled. Halting the system isn't feasible, since it is remote and I don't want to trek to the basement to turn it back on. What worked is sudo shutdown -r 0. I'm running Ubuntu 13.04 server on an Asus ...


5

I followed the instructions from the following link (http://velvet-underscore.blogspot.com/2013/01/chrubuntu-virtualbox-with-kvm.html) and updated the script for Kernel 3.8.0 for Acer C7 running on Chrubuntu: #!/bin/bash set -x # # Grab verified boot utilities from ChromeOS. # mkdir -p /usr/share/vboot mount -o ro /dev/sda3 /mnt cp ...



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