Questions tagged [linux]

These questions are about Linux in general -- NOT specific to a particular distribution. If the question just happens to be in a Linux environment, please specify your Linux distribution in the body of your question, but do NOT use the /linux tag.

In a narrow sense, Linux is a Unix-like kernel started by Linus Torvalds in 1991. For questions that are specifically about the kernel (e.g. how to configure and build it), use the tag .

The word Linux is commonly used to refer to an operating system built around the Linux kernel. This operating system includes many other components, notably from the GNU project, so the term GNU/Linux is preferred. This operating system can also be run without the Linux kernel, and is often, confusingly, still referred to as Linux.

There are many different GNU/Linux distributions (see ), including more or less the same programs but with different installers (see ), package managers (see ), and other customizations. Examples of common distributions are: , , , , , , , and .

Use this tag for questions that are specific to Linux-the-operating-system (GNU/Linux), such as hardware support, networking setup, filesystems, etc. Most questions should have another tags to identify the area of interest, e.g. , , , , , etc.

The Linux kernel is used in some non-unix-like embedded operating systems, the best known being Android. These operating systems are off-topic here (you can ask questions about using Android on Android Stack Exchange).

Further reading

35904 questions
780
votes
2 answers

How do I make `ls` show file sizes in megabytes?

What commands do I need for Linux's ls to show the file size in MB?
Paul Sheldrake
  • 7,913
  • 3
  • 13
  • 10
616
votes
6 answers

Finding the PID of the process using a specific port?

I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy. I used: netstat -nlp|grep 9000 to see if such a port exists and I got this: tcp 0 0 127.0.0.1:9000 0.0.0.0:* …
wuchang
  • 6,597
  • 5
  • 15
  • 16
555
votes
27 answers

How can I resolve a hostname to an IP address in a Bash script?

What's the most concise way to resolve a hostname to an IP address in a Bash script? I'm using Arch Linux.
Eugene Yarmash
  • 13,945
  • 12
  • 43
  • 56
486
votes
9 answers

Execute vs Read bit. How do directory permissions in Linux work?

In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux work?
Nick.h
  • 5,923
  • 4
  • 19
  • 16
429
votes
9 answers

When should I not kill -9 a process?

I am always very hesitant to run kill -9, but I see other admins do it almost routinely. I figure there is probably a sensible middle ground, so: When and why should kill -9 be used? When and why not? What should be tried before doing it? What kind…
Mikel
  • 54,321
  • 12
  • 124
  • 144
392
votes
3 answers

How to check OS and version using a Linux command

What is the Linux command to check the server OS and its version? I am connected to the server using shell.
sarath
  • 4,031
  • 3
  • 12
  • 4
387
votes
2 answers

Compress a folder with tar?

I'm trying to compress a folder (/var/www/) to ~/www_backups/$time.tar where $time is the current date. This is what I have: cd /var/www && sudo tar -czf ~/www_backups $time" I am completely lost and I've been at this for hours now. Not sure if…
qwerty
  • 4,011
  • 4
  • 15
  • 13
384
votes
1 answer

How do you empty the buffers and cache on a Linux system?

Prior to doing some benchmarking work how would one free up the memory (RAM) that the Linux Kernel is consuming for its buffers and cache? Note that this is mostly useful for benchmarking. Emptying the buffers and cache reduces performance! If…
slm
  • 349,796
  • 108
  • 742
  • 848
356
votes
18 answers

How do I set my DNS when resolv.conf is being overwritten?

Most of the info I see online says to edit /etc/resolv.conf, but any changes I make there just get overridden. $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND…
Seán Hayes
  • 4,451
  • 4
  • 14
  • 11
352
votes
10 answers

How to list all files ordered by size

I would like to list all files in the order of big to small in size and the files could be present anywhere in a certain folder.
Joe
  • 3,645
  • 2
  • 12
  • 4
349
votes
13 answers

How to know whether Wayland or X11 is being used

So I just installed the latest Kali Linux on my laptop which was based on Debian 7 (oldstable). I then dist-upgrad-ed the whole thing to Debian 8. I've always wanted Wayland instead of X11, so I installed the necessary packages. Then created a…
Dehbop
  • 3,719
  • 2
  • 10
  • 7
347
votes
10 answers

How can I monitor disk io?

I'd like to do some general disk io monitoring on a debian linux server. What are the tools I should know about that monitor disk io so I can see if a disk's performance is maxed out or spikes at certain time throughout the day?
camomileCase
  • 3,695
  • 3
  • 13
  • 7
337
votes
5 answers

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 directory should have g+rw automatically.
Chris
  • 7,870
  • 5
  • 22
  • 18
329
votes
27 answers

How can I get my external IP address in a shell script?

I need to find my external IP address from a shell script. At the moment I use this function: myip () { lwp-request -o text checkip.dyndns.org | awk '{ print $NF }' } But it relies on perl-libwww, perl-html-format, and perl-html-tree being…
Eugene Yarmash
  • 13,945
  • 12
  • 43
  • 56
323
votes
12 answers

How to know number of cores of a system in Linux?

I wanted to find out how many cores my system has, so I searched the same question in Google. I got some commands such as the lscpu command. When I tried this command, it gave me the following result: $ lscpu Architecture: x86_64 CPU…
Mr ASquare
  • 3,435
  • 3
  • 11
  • 11
1
2 3
99 100