Most Popular

1500 questions
331
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…
331
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
  • 46,081
331
votes
3 answers

Can I remove files in /var/log/journal and /var/cache/abrt-di/usr?

I use Fedora and these directories contains a large amount of files, I wonder whether I can delete them? The system is running low on space.
hgajshb
  • 3,865
  • 4
  • 19
  • 18
329
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,989
329
votes
3 answers

How can I make "Press any key to continue"

I'm making a script to install my theme, after it finished installing it will appear the changelog and there will be "Press any key to continue" so that after users read the changelog then press any key to continue
326
votes
11 answers

What is the "eval" command in bash?

What can you do with the eval command? Why is it useful? Is it some kind of a built-in function in bash? There is no man page for it..
LanceBaynes
  • 40,135
  • 97
  • 255
  • 351
323
votes
3 answers

How to import secret gpg key (copied from one machine to another)?

I'm trying to copy my gpg key from one machine to another. I do: gpg --export ${ID} > public.key gpg --export-secret-key ${ID} > private.key Move files to new machine, and then: gpg --import public.key gpg: nyckel [ID]: public key [Name, e-mail]…
user50849
  • 5,202
323
votes
7 answers

How create a temporary file in shell script?

While running a script, I want to create a temporary file in /tmp directory. After execution of that script, that will be cleaned by that script. How to do that in shell script?
Bhuvanesh
  • 3,365
  • 3
  • 13
  • 7
322
votes
7 answers

What's the point in adding a new line to the end of a file?

Some compilers (especially C or C++ ones) give you warnings about: No new line at end of file I thought this would be a C-programmers-only problem, but github displays a message in the commit view: \ No newline at end of file for a PHP file. I…
322
votes
1 answer

How to change where a symlink points

Can you tell me what this is in the area marked red? If I want to change /media/files/tb-prod/files to some other path, how would I do that?
Jalil Khan
  • 3,331
321
votes
24 answers

How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I setup for a tail command that would help me do this?
Amir Afghani
  • 7,203
  • 11
  • 27
  • 23
320
votes
10 answers

Can rsync resume after being interrupted?

I used rsync to copy a large number of files, but my OS (Ubuntu) restarted unexpectedly: sudo rsync -azvv /home/path/folder1/ /home/path/folder2 After reboot, I ran rsync again, but from the output on the terminal, I found that rsync still copied…
Tim
  • 101,790
320
votes
12 answers

How can I test if a variable is empty or contains only spaces?

The following bash syntax verifies if param isn't empty: [[ ! -z $param ]] For example: param="" [[ ! -z $param ]] && echo "I am not zero" No output and its fine. But when param is empty except for one (or more) space characters, then the…
maihabunash
  • 7,131
317
votes
25 answers

Colorizing your terminal and shell environment?

I spend most of my time working in Unix environments and using terminal emulators. I try to use color on the command line, because color makes the output more useful and intuitive. What options exist to add color to my terminal environment? What…
Stefan Lasiewski
  • 19,754
  • 24
  • 70
  • 85
314
votes
6 answers

Multiple similar entries in ssh config

Say I want to configure my ssh options for 30 servers with the same setup in my .ssh config file: host XXX HostName XXX.YYY.com User my_username Compression yes Ciphers arcfour,blowfish-cbc Protocol 2 ControlMaster…