Most Popular

1500 questions
187
votes
7 answers

How do I do a ls and then sort the results by date created?

In what order are the dated ordered by? Certainly not alphanumeric order. ls -lt sorts by modification time. But I need creation time.
InquilineKea
  • 6,152
  • 12
  • 43
  • 42
186
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
  • 3,328
  • 6
  • 21
  • 26
186
votes
7 answers

How can I have `date` output the time from a different time zone?

I have a server running with the time zone set to UTC. It seemed like that was generally a good practice (please correct me if I'm wrong). Anyhow, one of the servers I connect to, in order to scp files, is running on EDT and stores files that I need…
cwd
  • 44,479
  • 71
  • 146
  • 167
186
votes
14 answers

How can I move files and view the progress (e.g. with a progress bar)?

When moving large directories using mv, is there a way to view the progress (%)? The cp command on gentoo had a -g switch that showed the progress.
letronje
  • 2,045
  • 2
  • 14
  • 7
186
votes
4 answers

Where do executables look for shared objects at runtime?

I understand how to define include shared objects at linking/compile time. However, I still wonder how do executables look for the shared object (*.so libraries) at execution time. For instance, my app a.out calls functions defined in the lib.so…
rahmu
  • 19,673
  • 28
  • 87
  • 128
185
votes
2 answers

How to create nested directory in a single command?

Apparently, it's not possible to create a nested directory in a single command? $ sudo mkdir x/y/z mkdir: cannot create directory 'x/y/z': No such file or directory
BaltoStar
  • 2,331
  • 3
  • 16
  • 11
185
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
  • 1,952
  • 2
  • 12
  • 8
185
votes
7 answers

How do I delete the first n lines of an ascii file using shell commands?

I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so that I can use the pure matrix information in…
Paul
  • 9,163
  • 12
  • 32
  • 30
184
votes
4 answers

Good detailed explanation of /etc/network/interfaces syntax?

I understood the very basic concept of how to use /etc/network/interfaces, but all I find online are examples, example after example, which I can copy-paste from. What I miss is an explanation of the syntax, an explanation of the meaning of the…
Foo Bar
  • 3,462
  • 7
  • 21
  • 28
183
votes
3 answers

Timezone setting in Linux

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 behavior? I'm assuming the date command should display…
Rahul Dhobi
  • 2,037
  • 3
  • 14
  • 11
182
votes
5 answers

How to do I convert an animated gif to an mp4 or mv4 on the command line?

What command would I use to convert an mp4 or mv4 video file to an animated gif, and vice versa. That is, convert a animated gif to a mp4 or mv4.
stinkypyper
182
votes
8 answers

Viewing all iptables rules

Is there a way to view iptables rules in a bit more detail? I recently added masquerade to a range of IPs: iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE service iptables save service iptables restart Which has done what I want…
TheLovelySausage
  • 4,183
  • 9
  • 30
  • 49
182
votes
6 answers

Trying to SSH to local VM Ubuntu with Putty

I have set up a VM of Ubuntu server, have installed OpenSSH, and am now trying to connect to it using Putty. Within Putty, under "Host name", I put "Ubuntu", given this is what I thought it was called when I set up the VM. However, I just get the…
wickywills
  • 2,093
  • 3
  • 14
  • 18
181
votes
1 answer

How to clean log file?

Is there a better way to clean the log file? I usually delete the old logfile and create a new logfile and I am looking for a shorter type/bash/command program. How can I use an alias?
Micromega
  • 4,201
  • 5
  • 27
  • 34
181
votes
8 answers

How do I limit the number of files printed by ls?

Is there a way to limit the quantity of listed files on a ls command? I've seen: ls | head -4 but to get head or tail to be executed I need to wait for ls to finish execution, and with directories with an enourmous quantity of files that can take…
AndreDurao
  • 2,010
  • 2
  • 13
  • 8