Most Popular

1500 questions
88
votes
6 answers

Redirecting the content of a file to the command "echo"

I have a file named my_file.txt whose content is just the string Hello. How could I redirect its content to the command echo? I know I have the commands less, cat, more... but I need to do it with echo. I tried this: $ cat my_file.txt | echo and…
danielmbcn
  • 1,075
  • 1
  • 8
  • 7
88
votes
4 answers

Is there any way to keep a command from being added to your history?

Is there any way to keep a command from being added to your history? I have a command that I want to keep out of my history file, and I really don't care to have it there when I search the history stored in memory, though that's less of a concern.…
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
88
votes
6 answers

Why do iptables rules disappear when restarting my Debian system?

I add this rule: sudo iptables -t nat -A OUTPUT -d a.b.c.d -p tcp \ --dport 1723 -j DNAT --to-destination a.b.c.d:10000 When restart computer rules are deleted. Why? What I can do to make the rules persist?
Jhonathan
  • 3,525
  • 4
  • 24
  • 23
88
votes
3 answers

The 'less' command-line equivalent of 'tail -f'

I would like to open up a file using less, and have it automatically scroll the file similar to tail -f. I know that I can do less file, and then hit Shift-F to forward forever; like tail -f. I need less because it provides the --raw-control-chars…
Stefan Lasiewski
  • 19,264
  • 24
  • 70
  • 85
88
votes
9 answers

How to download package not install it with apt-get command?

sudo apt-get install pppoe will download pppoe package and install it. Is it possible to just download pppoe package and not install it with apt-get command? wget…
showkey
  • 79
  • 23
  • 67
  • 128
88
votes
8 answers

Can I connect to Windows machine from Linux shell?

I can connect to Linux machines from Windows using PuTTY/SSH. I want to do the other way round - connect to a Windows machine from Linux. Is this possible?
vis
  • 1,007
  • 1
  • 9
  • 8
88
votes
3 answers

Piping commands after a piped xargs

HP-UX ***** B.11.23 U ia64 **** unlimited-user license find . -type d -name *log* | xargs ls -la gives me the directory names (the ones which contain log in the directory name) followed by all files within that directory. The directories …
anotherperson1
  • 1,199
  • 3
  • 11
  • 20
88
votes
6 answers

How to pass password to mysql command line

I have MySQL password saved on a file foo.php, for example P455w0rd, when I try to use it: $ cat foo.php | grep '$dbpwd=' | cut -d '"' -f 2 | mysql -U root -p mydb -h friendserver Enter password: (holds) $ echo P455w0rd | mysql -u root -p mydb -h…
Kokizzu
  • 9,257
  • 12
  • 55
  • 82
88
votes
3 answers

What is the difference between these commands for bringing down a Linux server?

Reading "What is the difference between Halt and Shutdown commands?" , I generally have an idea what does the command shutdown does, with or without -h/-r options. The "halt" command performs power off of the system to run-level 0 of the…
Win.T
  • 1,115
  • 1
  • 11
  • 14
88
votes
5 answers

Xfce entered zoom mode. How do I exit?

I pressed something around my mouse pad (keys in the altgr region+mousepad - quite possibly multitouch) and suddenly the whole X11 display zoomed around 10%. That means I can see 90% of the 1920x1080 screen in a somewhat blurry version. When I move…
Ole Tange
  • 33,591
  • 31
  • 102
  • 198
88
votes
7 answers

List the files accessed by a program

time is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can list the files being accessed by a program and its children. Either in real time or as a report…
Ole Tange
  • 33,591
  • 31
  • 102
  • 198
88
votes
5 answers

'chmod g+s' command

Hello I want to understand the role of the chmod g+s command in Unix. I also would like to know what it does in this particular context: cd /home/canard; touch un; chgrp canard .; chmod g+s .; touch deux ; I understand all the commands roles except…
otus
  • 981
  • 1
  • 6
  • 3
88
votes
1 answer

Easy command line method to determine specific ARM architecture string?

I'm trying to write a script which will determine actions based on the architecture of the machine. I already use uname -m to gather the architecture line, however I do not know how many ARM architectures there are, nor do I know whether one is…
Thomas Ward
  • 2,600
  • 2
  • 18
  • 31
88
votes
4 answers

Use Mosh without giving up local scrollback / history?

Is there a way to use mosh without giving up the local scrollback? Basically, in some circumstances, IP-roaming is indeed useful and needed, but the extra terminal emulation and key prediction seems to only be getting rid of the local scrollback…
cnst
  • 3,223
  • 2
  • 23
  • 44
88
votes
5 answers

Comparing two files in Vim

Is it possible to view two files side-by-side in Vim? If so, how can I set up my editor to do this, and is there a way to diff between the two files within Vim? I am aware of the :next and :prev commands, but this is not what I'm after. It would…
Zaid
  • 10,442
  • 13
  • 38
  • 36