Tag Info

Hot answers tagged

8

Using no external tools: You can just source (the source command is a dot .) the /etc/os-release and you'll have access to all the variables defined there: $ . /etc/os-release $ echo "$VERSION" 14.04, Trusty Tahr Edit. If you want to remove the 14.04, part (as asked by terdon), you could: $ . /etc/os-release $ read _ UBUNTU_VERSION_NAME <<< ...


5

My variant on what's already offered: . /etc/os-release; echo ${VERSION/*, /} The shortest, Bashiest answer to date. If you don't care to load /etc/os-release's contents into your current environment, you can fake bash into thinking it's loading a script fairly easily: bash <(cat /etc/os-release; echo 'echo ${VERSION/*, /}')


5

You can combine your command with a command that plays sounds. For example paplay: sudo apt-get update && sudo apt-get upgrade; paplay /usr/share/sounds/ubuntu/stereo/message.ogg Furthermore, if you want to play a sound if the command was successfully completed and another sound in case of an error, you can use something like: command && paplay ...


5

Add the line shopt -s globstar to the file .bashrc in your home directory. (To just try this out, type this on the command line, it will only take effect in your current shell.) Then you can use **/ to mean “in the current directory or a subdirectory and so on recursively”, i.e. the same thing as simple find commands. python **/myscript.py Caveat: **/ ...


5

$PS1 is an environment variable that tells yours sheel how to format the prompt. Changing the value with export, as you did, only applies to that session; so you can just open up a new shell (not a sub-shell) and see a familiar prompt. Otherwise, if you really want your prompt back in this session itself, run this command: export ...


4

I'll go out on a limb, and suggest the Ubuntu manual. I am assuming that you are running the stock distribution, and not a variant such as kubuntu, or xubuntu. I did actually find a little annoying to find, having to navigate --> Ubuntu.com --> community --> help and information --> official documentation --> 14.04 LTS --> Desktop Guide But also, the ...


4

If you want to use the file list from find as arguments for the sed command (instead as imput, which is what your line is doing), you have to use either the xargs command: find dir -name '*.html' | xargs -d \\n sed -i "COMMANDS" In which case xargs takes the file list, using newline (\n) as separator between file names and starts sed with them as ...


4

Grep: $ grep $(lsb_release -rs) /usr/share/python-apt/templates/Ubuntu.info | grep -m 1 "Description: Ubuntu " | cut -d "'" -f2 Trusty Tahr Explanation: lsb_release -rs -> Prints your installed Ubuntu version. grep $(lsb_release -rs) /usr/share/python-apt/templates/Ubuntu.info -> Grab all the lines which contains your release version, in my case it's ...


4

The best way is to add a symbolic link to this file in the /bin directory: cd /usr/local/bin ln -s server-stop.sh /path/to/your/folder/server-stop.sh In this case, you are adding a link to the original file, so you can always change the original file and you command will always be working.


4

Your question isn't very clear but if by "archive" you mean a compressed file (such as zip) then perhaps this answer will help? How to mount a zip file as a file system? After mounting the archive you would be able to cd into it.


3

I would use the bash built-in command hash to remember the location of the server-stop.sh script: hash -p /path/to/folder/server-stop.sh server-stop Just add the above line to your .bashrc file. You can now use server-stop everywhere in your bash shell/scripts. See help hash: hash: hash [-lr] [-p pathname] [-dt] [name ...] Remember or display program ...


3

That's because each package has specific details about how it can be installed. Post-processing for a package sometimes has follow up (symlinking, documentation generation, et cetera). Such processing may pre-depend on other processes having completed. This isn't a Linux flaw. It's a "computation" flaw. (https://en.wikipedia.org/wiki/Halting_problem). No ...


3

In layman's terms, rm unlinks the file. "moving to trash" is something equivalent to mv file ~/.local/share/Trash in terminal, which means the file was moved from one directory to another directory. P.S.: This question came up as the first result when I did a Google search for "ubuntu rm trash difference". I hope you can do some research next time ...


3

Not knowing exactly what's being done, I can only speak generally: Reads are simply reads from memory or disk. Writes have to check constraints, action triggers and then write to disk. Usually within a transaction that needs to be setup, actioned committed and then cleaned up. And then there's cache invalidation. Most disks (and their filesystems) read ...


3

The basic command option is to add (width x height) is “–geometry=WxH” option . Here is the command you can try it and specify your own options : First : killall -9 nautilus Then : nautilus computer: --geometry=860x480


3

Creating links in /usr/bin works, but unless you want the scripts to be available for all users, I would prefer to create the links in ~/bin, with the same result, but not touching the global system. Furthermore, OP has not mentioned where the scripts are stored. creating a link globally while the scripts are stored locally is bad practice, so alltogether I ...


3

The screenshot below show the problem: you have an invisible char ^M after the python in the shebang line. This is probably a remnant of having edited the file on a non-Unix machine (typically, Windows); so the interpreter looked for is python^M which is not found. If you haven't edited this file on a alien os, maybe it's a problem with the line-ending ...


3

Your file has Windows line endings, which unix shells don't like. Just convert them to Unix file endings using dos2unix aaa.py (you may need to install dos2unix, which is a very light [200kB] but useful software) and you should be fine. Different line endings representations are a common source of "strange" problems. You can check line endings with ...


2

That error is happening because the ! (bang) is a shortcut that allows you re-run a command from your history. Ex: This command re-runs command #1504 from my history. $ !1504 To avoid that issue, try encapsulating your directory name with single quotes. $ cd '!)e$!gn&(reate' That being said, while Ubuntu (Linux) will let you name directories in ...


2

The problem is the space around the = in the command. Look: [:~] % alias a=ls this works as expected [:~] % type a a is an alias for ls But [:~] % alias b =ls [:~] 1 % This does not work. zsh see two words, b and =ls; it uses the pathname expansion on the second one, and execute alias b /bin/ls --- it exits silently with error code 1 because ...


2

http://www.lybrary.com/linux-pocket-guide-p-230616.html?gclid=CKW1_5an8r0CFbFFMgodBE0AYQ This is a pretty good primer for lots of things. I actually used it once to burn an .ISO image from the terminal. It helped me learn a pretty good deal of info. It says it is for Red Hat, but for someone who has no terminal experience it works since they talk about ...


2

The only thing I can think of is changing terminal to something that supports multiple, tiled terminals. In my case the easiest way is through terminator (which is an alternative terminal application). Just surround your active terminal with other terminals: Or you could do it session-side with a multiplexer like tmux. I don't have any experience there so ...


2

Perhaps an alias is what you are looking for. Open your ~/.bash_aliases file and add the following to the end of the file(the file may be empty depending upon whether you have added an alias previously): alias server-stop.sh='/path/to/your/server-stop.sh` Pros: This will only add server-stop.sh as you intend to This won't change your $PATH variable ...


2

Tmux is a rewrite of GNU Screen, tmux offers a variety of improvements. Some of the most important include a client-server model, which allows you to connect to a tmux session from multiple locations, and a cleaner configuration file format. Check out tmux’s FAQ to discover a list of ways it differs from GNU Screen. Use this command to install tmux on ...


2

Normally you edit /etc/sysctl.conf and make those adjustments (rather then directly editing) See: http://www.cyberciti.biz/faq/linux-kernel-etcsysctl-conf-security-hardening/ /proc is a "virtual file system" used by the kernel and the information within the "files" is managed by the kernel and adjusted / configured by editing system configuration files ...


2

Oddly the easiest way seems to be looking at /proc/net/dev. I've written the following to compare that file twice (with a second delay) and then to subtract the total bytes values. In this case em1 is the network adaptor so just change that to whatever you need to look at. awk '/em1/ {i++; rx[i]=$2; tx[i]=$10}; END{print rx[2]-rx[1] " " tx[2]-tx[1]}' \ ...


2

Here's a variation on Oli's excellent solution: awk '{if(l1){print $2-l1,$10-l2} else{l1=$2; l2=$10;}}' \ <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev) It will print the same result as Oli's approach: $ awk '{if(l1){print $2-l1,$10-l2} else{l1=$2; l2=$10;}}' \ > <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 ...


2

We can nicely control our Bluetooth device with the command line tool hciconfig. To enable visibility: sudo hciconfig hciX piscan To disable visibility: sudo hciconfig hciX noscan Replace hciX with your device (usually hci0) To query your Bluetooth device(s): sudo hciconfig -a


1

In addition to the echo and printf shell builtins, if for some obscure reason you cannot use them, you also have cat. If you combine it with Here Strings, you can have it print the input you give it: cat <<<"Hello World" In fact, there are many commands that can do this if you twist their arm a little: $ tr '' '' <<<"Hello World" Hello ...


1

From the error you got from the FreeBASIC compiler you need to install the following packages: sudo apt-get install libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev When you have to install -dev packages, http://packages.ubuntu.com/ is a good place for finding the library package name. Finally use /usr/local/bin/fbc -lang qb roids.bas to ...



Only top voted, non community-wiki answers of a minimum length are eligible