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,701
- 7
- 19
- 35
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.
- 47,684