Questions tagged [linux]

Linux is the generic term for a UNIX-like open source operating system based on the Linux kernel.

GNU/Linux is a UNIX-like Open Source operating system. Linus Torvalds originally wrote the Linux kernel with contributions from others on the MINIX usenet board. Since then, Linux had thousands of developers, both paid by companies and volunteers. The main system tools and libraries for GNU/Linux are sourced from the GNU Project, hence the nomenclature GNU/Linux (GNU Toolchain over Linux Kernel). The Linux kernel is licensed under the GPL v2 license.

There are many different Linux Distributions (sometimes shortened to distro), which consist of software applications packaged and provided with the Linux kernel, being Slackware the oldest active distro and Debian, Red Hat and CentOS among the most used on Internet servers¹.

The Linux kernel is commonly run on servers but is highly portable and is used in a variety of applications, from wireless routers and cell phones to clusters and super computers with thousands of nodes and processors.

External Resources:

38271 questions
182
votes
31 answers

How do I prevent accidental rm -rf /*?

I just ran rm -rf /* accidentally, but I meant rm -rf ./* (notice the star after the slash). alias rm='rm -i' and --preserve-root by default didn't save me, so are there any automatic safeguards for this? I wasn't root and cancelled the command…
Valentin Nemcev
  • 2,015
  • 2
  • 14
  • 12
178
votes
8 answers

Filename length limits on linux?

Are there any filename or path length limits on Linux?
readonly
  • 3,359
  • 4
  • 26
  • 23
178
votes
8 answers

How do I sleep for a millisecond in bash or ksh

sleep is a very popular command and we can start sleep from 1 second: # wait one second please sleep 1 but what the alternative if I need to wait only 0.1 second or between 0.1 to 1 second ? remark: on linux or OS X sleep 0.XXX works fine , but…
yael
  • 2,433
  • 5
  • 31
  • 43
175
votes
9 answers

Is it possible to detach a process from its terminal? (Or, "I should have used screen!")

Possible Duplicate: Can I nohup/screen an already-started process? On Unix (specifically, Linux), I've started a job in a regular ssh->bash session. I'd like to leave work soon, but I now realize that the job is going to take several hours. If I…
mike
  • 3,963
  • 11
  • 30
  • 27
175
votes
18 answers

Disk full, du tells different. How to further investigate?

I have a SCSI disk in a server (hardware Raid 1), 32G, ext3 filesytem. df tells me that the disk is 100% full. If I delete 1G this is correctly shown. However, if I run a du -h -x / then du tells me that only 12G are used (I use -x because of some…
initall
  • 2,325
  • 3
  • 18
  • 19
174
votes
7 answers

What does Virtual memory size in top mean?

I am running top to monitor my server performance and 2 of my java processes show virtual memory of up to 800MB-1GB. Is that a bad thing? What does virtual memory mean? And oh btw, I have swap of 1GB and it shows 0% used. So I am confused. Java…
kapso
  • 2,083
  • 4
  • 15
  • 7
166
votes
2 answers

tar - Remove leading directory components on extraction

How can you extract only the target dir and not the complete dir tree? compress tar cf /var/www_bak/site.tar /var/www/site extract tar xf /var/www/site.tar -C /tmp This will produce: /tmp/var/www/site How is it possible to avoid the whole dir…
clarkk
  • 2,035
  • 8
  • 24
  • 36
163
votes
8 answers

What does 'set -e' do, and why might it be considered dangerous?

This question has appeared on a pre-interview quiz and it's making me crazy. Can anyone answer this and put me at ease? The quiz has no reference to a particular shell but the job description is for a unix sa. again the question is simply... What…
egorgry
  • 2,871
  • 2
  • 23
  • 21
161
votes
5 answers

Force dig to resolve without using cache

I'm wondering if there is a way to query a DNS server and bypass caching (with dig). Often I change a zone on the DNS server and I want to check if it resolves correctly from my workstation. But since the server caches resolved requests, I often get…
Daniel
  • 3,047
  • 5
  • 22
  • 27
160
votes
18 answers

What's the best way to check if a volume is mounted in a Bash script?

What's the best way to check if a volume is mounted in a Bash script? What I'd really like is a method that I can use like this: if then else fi
Mark Biek
  • 1,927
  • 2
  • 14
  • 12
152
votes
5 answers

List of files installed from apt package

How do I get a list of files that were or will-be installed when I apt-get a package? Conversely, can I find what package(s) caused a particular file to be installed?
David Nehme
  • 2,016
  • 4
  • 16
  • 13
152
votes
9 answers

What version of RHEL am I using?

From the shell and without root privileges, how can I determine what Red Hat Enterprise Linux version I'm running? Ideally, I'd like to get both the major and minor release version, for example RHEL 4.0 or RHEL 5.1, etc.
Arthur Ulfeldt
  • 3,249
  • 9
  • 33
  • 40
152
votes
19 answers

How to add a timestamp to bash script log?

I have a constantly running script that I output to a log file: script.sh >> /var/log/logfile I'd like to add a timestamp before each line that is appended to the log. Like: Sat Sep 10 21:33:06 UTC 2011 The server has booted up. Hmmph. Is there…
Antonius Bloch
  • 4,680
  • 6
  • 29
  • 41
152
votes
9 answers

How to remove empty/blank lines from a file in Unix (including spaces)?

How do I remove empty/blank (including spaces only) lines in a file in Unix/Linux using the command line? contents of file.txt Line:Text 1: 2:AAA 3: 4:BBB 5: 6:CCC 7: 8:DDD output desired…
Michael Ellick Ang
  • 2,039
  • 3
  • 14
  • 15
149
votes
13 answers

How do I find the UUID of a file system?

I'm running Ubuntu, and want to find out the UUID of a particular filesystem (not partition). I know I can use e2label /dev/sda1 to find out the file system label, but there doesn't seem to be a similar way to find the UUID.
Brad Gilbert
  • 2,503
  • 2
  • 21
  • 19