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
1729 votes
10 answers

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
1582 votes
6 answers

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 ...
Leonid Volnitsky's user avatar
691 votes
12 answers

View list of files in ZIP archive on Linux

How can I view the list of files in a ZIP archive without decompressing it?
johnlemon's user avatar
  • 7,463
641 votes
41 answers

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 ...
Denilson Sá Maia's user avatar
635 votes
7 answers

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
615 votes
5 answers

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 ...
Edward Tanguay's user avatar
590 votes
15 answers

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?
Open the way's user avatar
  • 8,543
585 votes
12 answers

Automatically answer 'Yes' when using apt-get install

Is there a way to make apt-get install automatically choose "yes" upon the Do you want to continue [y/N]? confirmation dialog?
mistiry's user avatar
  • 6,837
573 votes
7 answers

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 ...
n0pe's user avatar
  • 16.6k
565 votes
16 answers

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? ...
Simon's user avatar
  • 6,142
563 votes
4 answers

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 ...
User1's user avatar
  • 9,242
527 votes
6 answers

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?
Jury A's user avatar
  • 5,415
506 votes
7 answers

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 ...
eMeL's user avatar
  • 5,161
506 votes
9 answers

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 ...
vaid's user avatar
  • 3,539
493 votes
18 answers

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, ...
Andrew's user avatar
  • 14.9k
485 votes
7 answers

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
Scottie T's user avatar
  • 5,051
482 votes
15 answers

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,...
Steve HHH's user avatar
  • 7,080
469 votes
18 answers

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 ...
user avatar
448 votes
5 answers

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 ...
Bobby's user avatar
  • 4,591
437 votes
7 answers

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 -p 5566 After the connection is established and I write the message and send it I can’...
Andreea's user avatar
  • 4,481
425 votes
9 answers

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 ...
2ndkauboy's user avatar
  • 4,443
411 votes
11 answers

How to check which apache modules are enabled/installed?

Which is the most elegant way to check which apache modules are enabled?
udo's user avatar
  • 8,011
395 votes
21 answers

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
386 votes
4 answers

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: ...
Lydon Ch's user avatar
  • 5,939
368 votes
10 answers

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
11 answers

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?
AndreaNobili's user avatar
  • 7,121
347 votes
19 answers

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 ...
Peltier's user avatar
  • 6,264
334 votes
3 answers

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 ...
Nicolas Raoul's user avatar
330 votes
9 answers

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" ...
agentofuser's user avatar
  • 7,337
308 votes
5 answers

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/...
Sean Adkinson's user avatar
299 votes
10 answers

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++.
Christopher Gwilliams's user avatar
288 votes
5 answers

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 ...
Thierry Lam's user avatar
  • 4,307
284 votes
7 answers

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 ...
Sen's user avatar
  • 2,943
283 votes
6 answers

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 ...
Jimm Chen's user avatar
  • 5,864
278 votes
10 answers

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/...
Matthew's user avatar
  • 14.8k
274 votes
9 answers

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). ...
Matthew's user avatar
  • 14.8k
274 votes
3 answers

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 ...
Tim's user avatar
  • 17.2k
271 votes
9 answers

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 ...
Stanley Mungai's user avatar
271 votes
3 answers

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.
moinudin's user avatar
  • 3,064
269 votes
19 answers

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
267 votes
8 answers

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?
user70192's user avatar
  • 2,799
265 votes
11 answers

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 PING (67.222....
AndreaNobili's user avatar
  • 7,121
259 votes
7 answers

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?
Deleted's user avatar
  • 5,088
253 votes
8 answers

Read the contents of a zipped file without extraction?

How can I read the contents of a particular file in an archive without extracting the .zip it is contained within? I'm using the Linux command line. An earlier question asks about viewing the ...
Shrikanth's user avatar
  • 2,531
252 votes
8 answers

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.
Malfist's user avatar
  • 3,049
251 votes
4 answers

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 ?
marioosh's user avatar
  • 3,551
251 votes
5 answers

Linux Bash Script, Single Command But Multiple Lines?

I have the following script I wrote by searching Google, and it backs up my Linux system to an archive: #!/bin/bash # init DATE=$(date +20%y%m%d) tar -cvpzf /share/Recovery/Snapshots/$HOSTNAME_$...
Jay LaCroix's user avatar
  • 2,531
247 votes
35 answers

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?
tir38's user avatar
  • 2,711
246 votes
8 answers

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 ...
shantanuo's user avatar
  • 2,763
245 votes
9 answers

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 ...
Carson Myers's user avatar
  • 3,101

2 3 4 5