Skip to main content

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.

Filter by
Sorted by
Tagged with
900 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's user avatar
764 votes
8 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 ...
wuchang's user avatar
  • 8,097
612 votes
28 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's user avatar
528 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 ...
Nick.h's user avatar
  • 6,373
461 votes
13 answers

How to know whether Wayland or X11 is being used

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 ...
Dehbop's user avatar
  • 4,839
446 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 ...
qwerty's user avatar
  • 4,601
436 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 ...
Mikel's user avatar
  • 57.6k
400 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 ...
slm's user avatar
  • 372k
397 votes
3 answers

How to check OS and version using a Linux command [duplicate]

What is the Linux command to check the server OS and its version? I am connected to the server using shell.
sarath's user avatar
  • 4,081
380 votes
12 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's user avatar
  • 3,933
372 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 ...
Chris's user avatar
  • 8,590
367 votes
12 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 ...
camomileCase's user avatar
  • 3,895
364 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 ...
Seán Hayes's user avatar
  • 4,541
358 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: ...
Mr ASquare's user avatar
  • 3,775
348 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 | awk '{ print $NF }' } But it relies on perl-libwww,...
Eugene Yarmash's user avatar
303 votes
9 answers

How to display meminfo in megabytes in top?

Sometimes it is not comfortable to see meminfo in kilobytes when you have several gigs of RAM. In Linux, it looks like: And here is how it looks in Mac OS X: Is there a way to display meminfo in ...
Anthony Ananich's user avatar
295 votes
10 answers

How to know if a disk is an SSD or an HDD

I want to know whether a disk is a solid-state drive or hard disk. lshw is not installed. I do yum install lshw and it says there is no package named lshw. I do not know which version of http://pkgs....
user4951's user avatar
  • 10.6k
294 votes
2 answers

how can I recursively delete empty directories in my home directory? [duplicate]

Possible Duplicate: How to remove all empty directories in a subtree? I create directories very often, scattered over my home directory, and I find it very hard to locate and delete them. I want ...
Santosh Kumar's user avatar
288 votes
16 answers

How do I find out what hard disks are in the system?

I need to know what hard disks are available, including ones that aren't mounted and possibly aren't formatted. I can't find them in dmesg or /var/log/messages (too much to scroll through). I'm hoping ...
xenoterracide's user avatar
284 votes
24 answers

Efficiently delete large directory containing thousands of files

We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files. There are so many files that performing rm -rf returns an error and instead what we need to do is something ...
Toby's user avatar
  • 4,003
280 votes
2 answers

Kernel inotify watch limit reached

I'm currently facing a problem on a linux box where as root I have commands returning error because inotify watch limit has been reached. # tail -f /var/log/messages [...] tail: cannot watch '/var/...
Ultraspider's user avatar
  • 3,083
273 votes
6 answers

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 ...
Gilles 'SO- stop being evil''s user avatar
267 votes
12 answers

linux: How can I view all UUIDs for all available disks on my system?

My /etc/fstab contains this: # / was on /dev/sda1 during installation UUID=77d8da74-a690-481a-86d5-9beab5a8e842 / ext4 errors=remount-ro 0 1 There are several other disks on ...
Stefan Lasiewski's user avatar
267 votes
3 answers

Difference between cp -r and cp -a

I'm looking for the difference between cp -r and cp -a. What does "recursive" mean in terms of copying files from a folder?
Randy's user avatar
  • 2,779
267 votes
3 answers

Linux "top" command: What are us, sy, ni, id, wa, hi, si and st (for CPU usage)?

When I issue top in Linux, I get a result similar to this: One of the lines has CPU usage information represented like this: Cpu(s): 87.3%us, 1.2%sy, 0.0%ni, 27.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0....
its_me's user avatar
  • 14.1k
260 votes
4 answers

What does aux mean in `ps aux`?

ps aux seems to conveniently list all processes and their status and resource usage (Linux/BSD/MacOS), however I cannot comprehend the meaning of parameter aux using man ps. What does aux mean?
Howard's user avatar
  • 5,249
253 votes
12 answers

Limit memory usage for a single Linux process

I'm running pdftoppm to convert a user-provided PDF into a 300DPI image. This works great, except if the user provides an PDF with a very large page size. pdftoppm will allocate enough memory to ...
Ben Dilts's user avatar
  • 2,633
253 votes
20 answers

How can I get distribution name and version number in a simple shell script?

I'm working on a simple bash script that should be able to run on Ubuntu and CentOS distributions (support for Debian and Fedora/RHEL would be a plus) and I need to know the name and version of the ...
Alix Axel's user avatar
  • 2,939
250 votes
11 answers

How can I edit multiple files in Vim?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
cwd's user avatar
  • 45.7k
250 votes
5 answers

How to get the complete and exact list of mounted filesystems in Linux?

I usually use mount to check which filesystems are mounted. I also know there is some connection between mount and /etc/mtab but I'm not sure about the details. After reading How to check if /proc/ is ...
xanpeng's user avatar
  • 5,805
245 votes
4 answers

How can get a list of all scheduled cron jobs on my machine?

My sysadmin has set up a bunch of cron jobs on my machine. I'd like to know exactly what is scheduled for what time. How can I get that list?
Frank's user avatar
  • 2,791
238 votes
21 answers

How to download portion of video with youtube-dl command?

I am using Ubuntu, and the youtube-dl command is working absolutely fine. However, now I want to download only a portion a video that is too long. So I want to download only a few minutes of that ...
user3181614's user avatar
  • 2,481
233 votes
7 answers

How can I see dmesg output as it changes?

I'm writing a device driver that prints error message into ring buffer dmesg output. I want to see the output of dmesg as it changes. How can I do this?
Milad Khajavi's user avatar
231 votes
14 answers

How to determine Linux kernel architecture?

uname -m gives i686 and uname -m gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I ...
user2914's user avatar
  • 2,731
225 votes
1 answer

How to skip "permission denied" errors when running find in Linux? [duplicate]

Possible Duplicate: How do I remove “permission denied” printout statements from the find program? When I run this command in Linux (SuSE): find / -name ant I get many error ...
user710818's user avatar
  • 2,489
220 votes
5 answers

How do I determine the number of RAM slots in use?

I forgot how many RAM (DIMM) modules are installed on my laptop. I do not want to unscrew it but want to look it up on the console using bash. How do I gather this information?
k0pernikus's user avatar
  • 15.7k
217 votes
4 answers

Why do we use su - and not just su?

I don't understand why su - is preferred over su to login as root.
Dharmit's user avatar
  • 4,330
215 votes
6 answers

Understanding of diff output

I have file1.txt this is the original text line2 line3 line4 happy hacking ! and file2.txt this is the original text line2 line4 happy hacking ! GNU is not UNIX if I do: diff ...
Jim's user avatar
  • 10.2k
210 votes
9 answers

Is Linux a Unix?

So, there are lots of different versions of Unix out there: HP-UX, AIX, BSD, etc. Linux is considered a Unix clone rather than an implementation of Unix. Are all the "real" Unices actual descendants ...
Shawn J. Goff's user avatar
203 votes
5 answers

How do I add X days to date and get new date?

I have Linux ( RH 5.3) machine I need to add/calculate 10 days plus date so then I will get new date (expiration date)) for example # date Sun Sep 11 07:59:16 IST 2012 So I need to get ...
user avatar
196 votes
6 answers

Too many levels of symbolic links

I created this file structure: test/src test/firefox When I run this command: ln -s test/src test/firefox I would expect a symbolic link test/firefox/src to be created pointing to test/src, ...
David Zorychta's user avatar
196 votes
8 answers

Can I watch the progress of a `sync` operation?

I've copied a large file to a USB disk mounted on a Linux system with async. This returns to a command prompt relatively quickly, but when I type sync, of course, it all has to go to disk, and that ...
mattdm's user avatar
  • 40.5k
195 votes
14 answers

Recover deleted files on Linux

Is there a command to recover/undelete deleted files by rm? rm -rf /path/to/myfile How can I recover myfile? If there is a tool to do this, how can I use it?
pylover's user avatar
  • 3,448
192 votes
21 answers

Determine the size of a block device

How can I find out the size of a block device, such as /dev/sda? Running ls -l gives no useful information.
lfaraone's user avatar
  • 2,022
192 votes
9 answers

Why would someone choose FreeBSD over Linux? [closed]

Why would someone choose FreeBSD over Linux? What are the advantages of FreeBSD compared to Linux? (My shared hosting provider uses FreeBSD.)
ilhan's user avatar
  • 2,261
186 votes
10 answers

What to do when a Linux desktop freezes?

I'm a Windows guy, dual booted recently, and now I'm using Linux Mint 12 When a Windows desktop freezes I refresh, or if I am using a program I use alt + F4 to exit the program or I can use ctrl + ...
Lynob's user avatar
  • 4,264
185 votes
3 answers

Linux: Difference between /dev/console, /dev/tty and /dev/tty0

On a Linux system, what is the difference between /dev/console, /dev/tty and /dev/tty0? What are their respective uses, and how do they compare?
Axel Fontaine's user avatar
183 votes
3 answers

Timezone setting in Linux [closed]

I'm setting the timezone to GMT+6 on my Linux machine by copying the zoneinfo file to /etc/localtime, but the date command is still showing the time as UTCtime-6. Can any one explain to me this ...
Rahul Dhobi's user avatar
  • 2,037
178 votes
10 answers

How can I find the hardware model in Linux?

I used a system information utility to take the model number of a system, and also of the motherboard. DMI System Manufacturer LENOVO DMI System Product 2306CTO DMI System Version ...
Eduard Florinescu's user avatar
178 votes
9 answers

Sorting down processes by memory usage

I am able to see the list of all the processes and the memory via ps aux and going through the VSZ and RSS Is there a way to sort down the output of this command by the descending order on RSS ...
Exps's user avatar
  • 1,883

2 3 4 5