Most Popular

1500 questions
97
votes
4 answers

Purpose and typical usage of /etc/rc.local

The header looks like this: #!/bin/sh -e # # rc.local - executed at the end of each multiuser runlevel # # Make sure that the script will "exit 0" on success or any other # value on error. What is the reason for this file (it does not contain…
Emanuel Berg
  • 6,903
  • 8
  • 44
  • 65
97
votes
16 answers

Transfer files using scp: permission denied

I try to transfer files from remote computer using ssh to my computer : scp My_file.txt user_id@server:/Home This should put My_file.txt in the home folder on my own computer, right? I get scp/Home: permission denied Also when I try:…
Erez
  • 981
97
votes
4 answers

Print size of directory content with tree command in tree 1.5?

I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not the cumulative size of its contents. /media/ ├── [ 16K] 64D9-E862 │   ├── [8.0K] downloads I know for…
AncientSwordRage
  • 1,774
  • 1
  • 20
  • 27
97
votes
14 answers

How to unload kernel module 'nvidia-drm'?

I'm trying to install the most up-to-date NVIDIA driver in Debian Stretch. I've downloaded NVIDIA-Linux-x86_64-390.48.run from here, but when I try to do sudo sh ./NVIDIA-Linux-x86_64-390.48.run as suggested, an error message appears. ERROR: An…
Rodrigo
  • 1,832
97
votes
5 answers

Extract file from docker image?

I'd like to extract a file from a Docker image without having to run the image. The docker save option is not currrently a viable option for me as it's saving too huge of a file just to un-tar a specific file.
BlakBat
  • 1,061
97
votes
3 answers

Can sed save its output to a file?

> can do it. echo "text" > file tee can do it. echo "test" | tee file Can sed do it without using either of the above? Is it possible to save the output of a sed command to a file without using either > or tee?
Folaht
  • 1,062
97
votes
3 answers

Awesome symbols and characters in a bash prompt

I just ran across a screenshot of someone's terminal: Is there a list of all of the characters which can be used in a Bash prompt, or can someone get me the character for the star and the right arrow?
Naftuli Kay
  • 39,676
97
votes
5 answers

Set systemd service to execute after fstab mount

I'm working on a systemd .service script that is supposed to start after a CIFS network location is mounted via /etc/fstab to /mnt/ on boot-up. The script waits for an OpenVPN dependency script to launch first, but I also want it to wait for mount…
P A N
  • 1,761
  • 4
  • 19
  • 23
97
votes
2 answers

How to limit a process to one CPU core in Linux?

How to limit process to one cpu core ? Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with all it's children, processes (threads)) to use one…
97
votes
5 answers

Difference between cp -r and cp -R (copy command)

cp -r is meant to copy files recursively, and cp -R for copying directories recursively. But I've checked, and both appear to copy both files and directories, the same thing. So, what's the difference actually?
its_me
  • 13,959
97
votes
3 answers

Bash: run command2 if command1 fails

I want to do something like this: if cmd1 && cmd2 echo success else echo epic fail fi How should I do it?
97
votes
15 answers

Removing control chars (including console codes / colours) from script output

I can use the "script" command to record an interactive session at the command line. However, this includes all control characters and colour codes. I can remove control characters (like backspace) with "col -b", but I can't find a simple way to…
andrew cooke
  • 1,081
97
votes
5 answers

How do you hide a tmux pane?

I have 3 panes in my tmux window: -------------------------- | | 2 | | | | | 1 |----------| | | 3 | | | | -------------------------- Panes 1 and 2 have vim.…
user881300
  • 1,529
  • 2
  • 13
  • 14
97
votes
6 answers

How to enable and use code folding in Vim?

How can I enable and do code folding in Vim? Do I have to change anything in ~/.vimrc? I type z+a and z+c and z+o and nothing happens. Here is an article about folding: Code folding in Vim.
Mohammad Reza Rezwani
  • 1,235
  • 2
  • 10
  • 9
97
votes
15 answers

How do I get current keyboard layout?

I'm wondering if there is any command line tool that returns the current keyboard layout. I have XkbLayout set to us, ru. Update: setxkbmap returns layout settings, not selected layout. E.g.: $ setxkbmap -print | grep xkb_symbols xkb_symbols {…
Andrew
  • 1,432