Most Popular

1500 questions
343
votes
4 answers

What do the fields in ls -al output mean?

The ls -al command shows the following output; -rwxrw-r-- 10 root root 2048 Jan 13 07:11 afile.exe What are all the fields in the preceding display?
Mr. White
  • 3,617
  • 3
  • 13
  • 9
342
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 checkip.dyndns.org | awk '{ print $NF }' } But it relies on perl-libwww, perl-html-format, and perl-html-tree being…
Eugene Yarmash
  • 14,675
  • 14
  • 50
  • 57
340
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: $ lscpu Architecture: x86_64 CPU…
Mr ASquare
  • 3,605
  • 4
  • 12
  • 11
337
votes
5 answers

What's the story behind Super Cow Powers?

As we know, apt-get has Super Cow Powers and aptitude does not: $ apt-get --help | grep -i cow This APT has Super Cow Powers. $ aptitude --help | grep -i cow This aptitude does not have Super Cow Powers. and…
derobert
  • 107,579
  • 20
  • 231
  • 279
336
votes
18 answers

Is it possible to see cp speed and percent copied?

I'm having problems when copying large files using nautilus (it gets stuck). I need to copy, using cp. I would like to know if there are any parameters that shows the % copied and also the transfer speed.
user27807
336
votes
4 answers

How to get the pid of the last executed command in shell script?

I want to have a shell script like this: my-app & echo $my-app-pid But I do not know how the get the pid of the just executed command. I know I can just use the jobs -p my-app command to grep the pid. But if I want to execute the shell multiple…
David S.
  • 5,529
  • 5
  • 30
  • 39
336
votes
2 answers

How can I instruct yum to install a specific version of package X?

If there are two (or more) versions of a given RPM available in a YUM repository, how can I instruct yum to install the version I want? Looking through the Koji build service I notice that there are several versions.     
slm
  • 363,520
  • 117
  • 767
  • 871
331
votes
10 answers

How to split the terminal into more than one "view"?

From vi, if you issue the command :sp, the screen splits into two "views", allowing you to edit more than one file from the same terminal. Along those same lines, is there a way to have multiple shells open in the same terminal?
Justin Ethier
  • 16,686
  • 9
  • 43
  • 55
331
votes
7 answers

How do I equally balance tmux(1) split panes?

I'm looking for a behavior that is similar to how vim(1) handles its split windows with ^w =. I know tmux(1) has predefined layouts with ^b Meta[1-5], but this likely does not have the layout that I am currently using. When splitting a window, it…
Aaron Toponce
  • 4,514
  • 2
  • 18
  • 12
331
votes
12 answers

How to terminate a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to terminate its process, then re-run the command. How can I terminate it? I haven't closed its shell window. But as you know it doesn't stop using…
330
votes
5 answers

Why doesn't my Bash script recognize aliases?

In my ~/.bashrc file reside two definitions: commandA, which is an alias to a longer path commandB, which is an alias to a Bash script I want to process the same file with these two commands, so I wrote the following Bash script: #!/bin/bash for…
Zaid
  • 10,442
  • 13
  • 38
  • 36
328
votes
12 answers

How to colorize output of git?

Is there a way to color output for git (or any command)? Consider: baller@Laptop:~/rails/spunky-monkey$ git status # On branch new-message-types # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use…
B Seven
  • 7,659
  • 7
  • 23
  • 20
325
votes
10 answers

Copy a file back to local system with ssh

If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH from the remote system back to the local system?
Shawn J. Goff
  • 45,338
  • 25
  • 134
  • 145
325
votes
5 answers

Sort and count number of occurrence of lines

I have Apache logfile, access.log, how to count number of line occurrence in that file? for example the result of cut -f 7 -d ' ' | cut -d '?' -f 1 | tr '[:upper:]' '[:lower:]' is a.php b.php a.php c.php d.php b.php a.php the result that I want…
Kokizzu
  • 9,257
  • 12
  • 55
  • 82
320
votes
14 answers

What is `^M` and how do I get rid of it?

When I open the file in Vim, I see strange ^M characters. Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here: What is this ^M character? How could it have got there? How do I…
Christoph Wurm
  • 5,678
  • 5
  • 25
  • 28