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.
59,115
questions
1741
votes
10
answers
1.6m
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?
1582
votes
6
answers
164k
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 ...
703
votes
12
answers
791k
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?
646
votes
7
answers
926k
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 ...
644
votes
41
answers
559k
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 ...
626
votes
5
answers
1.6m
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 ...
603
votes
15
answers
356k
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?
589
votes
12
answers
638k
views
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?
579
votes
7
answers
772k
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 ...
574
votes
16
answers
489k
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?
...
572
votes
4
answers
225k
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 ...
535
votes
6
answers
1.3m
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?
523
votes
8
answers
899k
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 ...
507
votes
9
answers
57k
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 ...
503
votes
18
answers
742k
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, ...
489
votes
7
answers
260k
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
487
votes
16
answers
1.2m
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,...
474
votes
18
answers
866k
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 ...
451
votes
6
answers
601k
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 ...
446
votes
7
answers
1.3m
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’...
431
votes
9
answers
896k
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 ...
411
votes
11
answers
540k
views
How to check which apache modules are enabled/installed?
Which is the most elegant way to check which apache modules are enabled?
402
votes
21
answers
562k
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 ...
390
votes
4
answers
680k
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:
...
372
votes
10
answers
383k
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:...
358
votes
11
answers
778k
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?
352
votes
19
answers
321k
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 ...
338
votes
3
answers
479k
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 ...
336
votes
9
answers
116k
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" ...
314
votes
7
answers
368k
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/...
304
votes
10
answers
785k
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++.
295
votes
5
answers
143k
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 ...
289
votes
6
answers
323k
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 ...
285
votes
7
answers
310k
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 ...
280
votes
11
answers
757k
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/...
278
votes
8
answers
912k
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?
276
votes
20
answers
341k
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):
...
275
votes
9
answers
318k
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).
...
275
votes
3
answers
451k
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 ...
273
votes
3
answers
167k
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.
272
votes
9
answers
677k
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 ...
269
votes
7
answers
276k
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?
266
votes
11
answers
633k
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....
258
votes
5
answers
469k
views
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_$...
258
votes
8
answers
398k
views
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 ...
253
votes
4
answers
460k
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 ?
253
votes
8
answers
24k
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.
251
votes
35
answers
296k
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?
249
votes
10
answers
284k
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 ...
249
votes
11
answers
371k
views
What to do when Ctrl + C can't kill a process?
Ctrl + C doesn't always work to kill the current process (for instance, if that process is busy in certain network operations). In that case, you just see "^C" by your cursor and can't do ...