Questions tagged [linux]

A family of Unix-like operating systems using the Linux kernel. If your question is about a certain distribution only, use a more specific tag.

Filter by
Sorted by
Tagged with
1673 votes
10 answers
1.4m views

How can I sort the output of 'ls' by last modified date?

How can I sort the output of ls by last modified date?
user avatar
1572 votes
6 answers
163k views

How do I make a machine "blank screen" for a period of time (as a penalty) if certain noise levels are reached?

My kids (4 and 5) yell a lot when playing games on the computer. I found an effective cure for this. When I hear loud noises, I ssh into the game computer and do: chvt 3; sleep 15; chvt 7 This ...
625 votes
12 answers
674k views

View list of files in ZIP archive on Linux

How can I view the list of files in a ZIP archive without decompressing it?
  • 6,793
614 votes
40 answers
491k views

How to execute a command whenever a file changes?

I want a quick and simple way to execute a command whenever a file changes. I want something very simple, something I will leave running on a terminal and close it whenever I'm finished working with ...
589 votes
8 answers
725k views

Permissions on private key in .ssh folder?

I changed my permissions in my .ssh folder and now when I use a piece of software that uses my private key, I have to type my password each time. What should my permissions be on my id_rsa file to ...
user avatar
557 votes
5 answers
1.3m views

How to find a directory on linux?

I have a VPS with Suse Linux 10.3. I've logged in via SSH/putty and am trying to find where my web files are located. Since I'm uploading via FTP in a directory called httpdocs, I assume that this ...
547 votes
12 answers
537k views

Automatically answer 'Yes' when using apt-get install

Is there a way to make apt-get install answer "yes" to the "Do you want to continue [y/N]?"?
  • 6,447
546 votes
17 answers
293k views

When reading a file with `less` or `more`, how can I get the content in colors?

When I read a file in Linux with the command less or more, how can I get the content in colors?
  • 7,893
541 votes
7 answers
698k views

What is the "You have new mail" message in Linux/UNIX?

Sometimes, when I log into a box and 'su' to root, I get a cute little message saying I have mail (thank GOD it's not AOL). Where is this mail? What does it contain? Who/What sent it? How important ...
  • 16.1k
537 votes
4 answers
197k views

How to turn off word-wrap in less

Short version: How can I make the less utility in Linux not wrap lines? Long version: Often I need to view huge CSV files using less with hundreds of columns. I frequently only care about the first ...
  • 8,822
524 votes
16 answers
405k views

Reload a Linux user's group assignments without logging out

When assigning a user's secondary group list using: # usermod -G <grouplist> <user> is it possible to force this group assignment to take effect without logging out all running sessions? ...
  • 5,732
507 votes
9 answers
56k views

Did I just get hacked?

I am developing a consumer product, and it is supposed to be connected to the Internet, so as expected, it is connected to the Internet so that I can properly develop it. I went away for an hour or ...
  • 3,519
498 votes
6 answers
1.1m views

How to decompress a .bz2 file

I have a file as: filename.bz2 I need to decompress. I have tried the command: tar xvjf filename.tar.bz2, but it didn't work as the file is not a tar file. How do I decompress this file?
  • 5,125
464 votes
14 answers
1.0m views

Test if a port on a remote system is reachable (without telnet)

In the old days, we used telnet to see if a port on a remote host was open: telnet hostname port would attempt to connect to any port on any host and give you access to the raw TCP stream. These days,...
  • 6,820
451 votes
7 answers
219k views

What is the difference between executing a Bash script vs sourcing it?

What is the difference between executing a Bash script like A and sourcing a Bash script like B? A > ./myscript B > source myscript
  • 4,711
436 votes
18 answers
595k views

How to clear the contents of a file from the command line?

I have a log file that has a bunch of stuff in it that I don't need anymore. I want to clear the contents. I know how to print the contents to the screen: cat file.log I know how to edit the file, ...
  • 14.1k
436 votes
17 answers
743k views

How do I compare binary files in Linux?

I need to compare two binary files and get the output in the form: <fileoffset-hex> <file1-byte-hex> <file2-byte-hex> for every different byte. So if file1.bin is 00 90 00 11 in binary ...
user avatar
430 votes
5 answers
532k views

How can I resume a stopped job in Linux?

How can I resume a stopped job in Linux? I was using emacs and accidentally hit ctrl-z which blasted me back to the console. I can see it when I type 'jobs' [*****]$ jobs [1]+ Stopped ...
  • 4,411
417 votes
7 answers
656k views

How to remove systemd services

If I install a new service then decide I don’t want that application anymore and delete it, the service is still listed in the output from systemctl as error. Where is this coming from and how can I ...
  • 4,271
408 votes
7 answers
1.2m views

How do I exit an SSH connection?

I’m connecting to a server via SSH to send a message to a socket server using a command like: ssh 181.169.1.2 -p 5566 After the connection is established and I write the message and send it I can’...
  • 4,191
408 votes
11 answers
530k views

How to check which apache modules are enabled/installed?

Which is the most elegant way to check which apache modules are enabled?
  • 7,961
389 votes
9 answers
757k views

How to get the summarized sizes of directories and their subdirectories?

Let's say I want to get the size of each directory of a Linux file system. When I use ls -la I don't really get the summarized size of the folders. If I use df I get the size of each mounted file ...
  • 4,063
375 votes
21 answers
479k views

How do I detach a process from Terminal, entirely?

I use Tilda (drop-down terminal) on Ubuntu as my "command central" - pretty much the way others might use GNOME Do, Quicksilver or Launchy. However, I'm struggling with how to completely detach a ...
user avatar
366 votes
10 answers
361k views

chown is not changing symbolic link

I'm trying to change the user/group of a symbolic link with the command: $ chown -h myuser:mygroup mysymbolic/ But it's not changing. I'm logged in as root. The current user/group is set to root:...
user avatar
355 votes
4 answers
575k views

Go back to previous directory in shell

Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ? I'd like to type something like "back" and got returned to the previous directory I was in. Edit: ...
  • 5,519
344 votes
11 answers
711k views

If I know the PID number of a process, how can I get its name?

If I have the PID number for a process (on a UNIX machine), how can I find out the name of its associated process? What do I have to do?
  • 6,759
320 votes
18 answers
275k views

How to reliably keep an SSH tunnel open?

I use an SSH tunnel from work to go around various idotic firewalls (it's ok with my boss :)). The problem is, after a while the ssh connection usually hangs, and the tunnel is broken. If I could at ...
  • 5,844
318 votes
9 answers
105k views

How to append to a file as sudo?

I want to do: echo "something" >> /etc/config_file But, since only the root user has write permission to this file, I can't do that. But the following also doesn't work. sudo echo "something" ...
  • 7,077
297 votes
3 answers
399k views

Linux unzip command: Option to force overwrite?

I am writing a shell script that unzips a ZIP file into an existing hierarchy of files, potentially overwriting some of the files. The problem is that the unzip command asks for confirmation: replace ...
279 votes
10 answers
695k views

How can I list all IPs in the connected network, through Terminal preferably?

Using Ubuntu 10.10 command line, how can I list all IPs connected to my home network? Ideally, it needs to be a CLI command as I will be running it from C++.
275 votes
5 answers
134k views

What's the equivalent of Linux's updatedb command for the Mac?

If I want to use the locate command on a Linux machine, I usually run sudo updatedb first to update the database. I can run the locate command on OS X 10.5 but I can't find updatedb. What's the ...
  • 4,087
273 votes
7 answers
279k views

How do you gunzip a file and keep the .gz file?

The default behavior of gunzip is to delete the .gz file after it decompresses. How do I prevent it from deleting the file?? If this functionality is not included then is there an alternative ...
  • 2,833
272 votes
5 answers
296k views

How do you redirect wget response to standard out?

I have a crontab that wgets a PHP page every five minutes (just to run some the PHP code), and I want to send the output of the request to standard out, while sending the normal wget output to /dev/...
271 votes
3 answers
420k views

ps aux output meaning

When typing the command ps aux, what does each column of the output mean? For example: $ ps aux timothy 29217 0.0 0.0 11916 4560 pts/21 S+ 08:15 0:00 pine root 29505 0.0 0.0 38196 ...
  • 16.6k
264 votes
9 answers
671k views

How do I get an entire directory in sftp?

I'm just learning to use sftp, and I want to copy a directory from the remote computer to my local computer. If I try get [directory] it gives me this error: Cannot download non-regular file: /home/...
  • 14.1k
254 votes
8 answers
630k views

Get a list of Open Ports in Linux

I need a Linux command to list all free open ports for use in an application lsof -i TCP| fgrep LISTEN Does not seen to be helping as the Ports it lists are not necessarily free for use. How do I ...
252 votes
6 answers
270k views

How to have Linux ls command show second in time stamp

Something annoying about ls -l command is it shows only hour and minute for a file(like 08:30). How can I see the second portion(like 08:30:44)? man 1 ls and search for 'second' does not give any ...
  • 5,297
250 votes
11 answers
545k views

Is it possible to ping an address:port?

I am not into networking, and I have the following question related to the Linux ping command. Can I only ping an address? For example: miner@raspberrypi ~ $ ping onofri.org PING onofri.org (67.222....
  • 6,759
249 votes
3 answers
141k views

Rename screen session

Is it possible to change the name of a GNU screen session? Say I called started it with "screen -S foo" and I want to rename it to bar.
  • 2,844
244 votes
8 answers
243k views

In vim, how can I quickly switch between tabs?

In gnome-terminal, I can just press Alt + (1, 2, 3, etc.) to switch to specific tabs. I can also use Ctrl + (PgUp / PgDn) to cycle through tabs (admittedly less convenient, but it can be remapped). ...
  • 14.1k
244 votes
8 answers
22k views

What do the parentheses and number after a Unix command or C function mean?

I keep seeing parentheses and a number after a command in Unix or Linux or C function. For example: man(8), ftok(2), mount(8), etc. What do these mean? I see them in man too.
  • 2,959
243 votes
7 answers
745k views

Get Last Modified Date of File in Linux

I'm new to Linux. I'm using the command-line. I'm trying to view the last modified date of a file. How do I do that in Linux from the Command Line?
  • 2,559
241 votes
4 answers
394k views

How to convert .ppk key to OpenSSH key under Linux?

I know that is possible to convert .ppk under puttygen in Windows, but how to do that on Linux? Is this possible ?
  • 3,421
240 votes
18 answers
293k views

Unix/Linux find and sort by date modified

How can I do a simple find which would order the results by most recently modified? Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables): ...
user avatar
240 votes
5 answers
279k views

Recursively count all the files in a directory [duplicate]

Possible Duplicate: How can I count the number of folders in a drive using Linux? I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, ...
  • 2,920
238 votes
8 answers
248k views

How can I avoid SSH's host verification for known hosts?

I get the following prompt everytime I try to connect a server using SSH. I type "yes", but is there a way to aovid this? The authenticity of host '111.222.333.444 (111.222.333.444)' can't be ...
  • 2,663
237 votes
8 answers
783k views

How can I give write-access of a folder to all users in linux?

I installed apache2 on Ubuntu just now, and noticed that the /var/www folder is protected. I can just sudo everything but I would rather just give it write access. How can I do this? I tried sudo ...
  • 3,001
230 votes
7 answers
223k views

When should I use /dev/shm/ and when should I use /tmp/?

When should I use /dev/shm/ and when should I use /tmp/? Can I always rely on them both being there on UNIX?
  • 4,648
228 votes
29 answers
250k views

Is there a way to display a countdown or stopwatch timer in a terminal?

How can I display a real-time countdown timer on the Linux terminal? Is there an existing app or, even better, a one liner to do this?
  • 2,511
226 votes
5 answers
234k views

What does the asterisk mean after a filename when you type `ls -l`?

I've done an ls -l inside a directory, and my files are displaying like this : james@nevada:~/development/tools/android-sdk-linux_86/tools$ ll total 9512 drwxr-xr-x 3 james james 4096 2010-05-07 ...
  • 3,459

1
2 3 4 5
1129