I wonder if I can execute something in terminal, like .bat on Windows. Like, writing the script on the terminal, saving it somewhere, for example on desktop, and opening it, running automatically. I'm asking this beacuse Steam is bugged on Ubuntu 16.04, and the only way i can run this code LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DISPLAY=:0 steam
through terminal.

- 1,601
- 7
- 18
- 34
-
1Possible duplicate of Is there a way to make a file that would run a terminal command when you click it? – Jonas Czech Jan 12 '17 at 18:17
-
1Possible duplicate of How can I create launchers on my desktop? – wjandrea Jan 12 '17 at 18:31
1 Answers
Yes, you can run a command line manually and you can create bash
shellscript files and run them like bat
files in MSDOS and a cmd
window in Windows. The commands in linux are very powerful.
So start a terminal window from dash or with the hotkey combination ctrl + alt + t
and simply type the commands or copy and paste them into the terminal window. You can create a batch file with a text editor, gedit (graphical) or nano (text) and give it a name.
gedit filename
The name needs no extension (like bat
), but you should give it execute permissions to run it easily (text after # is a comment, not used by the shell).
chmod ugo+x filename # execute permisson u for user g for group and o for others
chmod +x filename # simplified when execute permisson for everybody
If you want to be sure, that bash
runs it (and no other shell), you can write the following into the first line of the shellscript file
#!/bin/bash
Now you can run it (in the current directory . (dot)) with
./filename
If you create the directory bin in your home directory
mkdir ~/bin
and move your shellscript into that directory, it will be in PATH
and can be run from any directory with
filename
PATH
works in the same way as in Windows.

- 46,324
- 5
- 88
- 152
-
Instead of
chmod ugo+x FILENAME
you can also just writechmod +x FILENAME
. If none ofugo
ora
are specified, it assumesa
, which equals all three ofugo
together. – Byte Commander Jan 12 '17 at 19:14 -
Thanks for this tip :-) I keep using the
ugo
string in order to remember it for instances, when I want separate permissions. – sudodus Jan 12 '17 at 19:19 -
Thanks, i managed to launch steam in other way, but your information explanation helped me for future things. – sticsk Jan 13 '17 at 12:46