- How to check os version in Linux command line
- Check os version in Linux
- The /etc/os-release file
- Checking OS version on Linux using the lsb_release command
- hostnamectl command
- uname command
- /etc/issue file
- Getting help
- Related media
- Conclusion
- How to check your Linux version: easy ways to view the distribution and version number
- Linux version: what do the distribution and version number mean?
- Checking the Linux version in the terminal
- Step 1: Distribution version number
- Step 2: Linux kernel version number
- Step 3: View everything at once with Inxi
- How to check Debian version: the quick and easy way
- How to check your Ubuntu version: a guide
- Remove a directory in Linux: a simple guide
- Deleting files in Linux: a how-to guide
- Linux find command: search and find files
- How to know which Linux Distribution I’m using? [closed]
- 6 Answers 6
- Visual Studio Code on Linux
- Installation
- Debian and Ubuntu based distributions
- RHEL, Fedora, and CentOS based distributions
- openSUSE and SLE-based distributions
- AUR package for Arch Linux
- Nix package for NixOS (or any Linux distribution using Nix package manager)
- Installing .rpm package manually
- Updates
- Node.js
- Setting VS Code as the default text editor
- xdg-open
- Debian alternatives system
- Windows as a Linux developer machine
- Windows Subsystem for Linux
- Next steps
- Common questions
- Azure VM Issues
- Debian and moving files to trash
- Conflicts with VS Code packages from other repositories
- «Visual Studio Code is unable to watch for file changes in this large workspace» (error ENOSPC)
- I can’t see Chinese characters in Ubuntu
- Package git is not installed
- The code bin command does not bring the window to the foreground on Ubuntu
- Cannot install .deb package due to «/etc/apt/sources.list.d/vscode.list: No such file or directory»
- Cannot move or resize the window while X forwarding a remote window
- Using the custom title bar
- Broken cursor in editor with display scaling enabled
- Repository changed its origin value
How to check os version in Linux command line
Check os version in Linux
The procedure to find os name and version on Linux:
- Open the terminal application (bash shell)
- For remote server login using the ssh: ssh user@server-name
- Type any one of the following command to find os name and version in Linux:
cat /etc/os-release
lsb_release -a
hostnamectl - Type the following command to find Linux kernel version:
uname -r
Let us see all examples in details for common Linux distros.
The /etc/os-release file
Type the following cat command:
$ cat /etc/os-release
Sample outputs:
We can filter out information such as OS version and name using the grep command/egrep command as follows:
$ grep ‘^VERSION’ /etc/os-release
$ egrep ‘^(VERSION|NAME)=’ /etc/os-release
Here is what we see:
Even tiny Linux distro such as Alpine Linux provide the required OS (Operating system) information, including version:
Checking OS version on Linux using the lsb_release command
The lsb_release command gives LSB (Linux Standard Base) and distribution-specific information on the CLI. The syntax is:
$ lsb_release -a
Sample outputs:
hostnamectl command
Use hostnamectl command to query and change the system hostname and related settings. Just type the following command to check OS name and Linux kernel version:
$ hostnamectl
And it will give info as follows. Look out for “ Operating System ” and “ Kernel “:
Another outputs from my OpenSUSE Linux 15.2 server:
uname command
/etc/issue file
Use more command/less command as follows:
$ cat /etc/issue
$ more /etc/issue
$ less /etc/issue
Getting help
You can also view the manual page on uname using the following command:
$ man hostnamectl
$ man uname
$ man cat
Related media
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Conclusion
We explained how to find and display the OS version on Linux. The safest option is to query /etc/os-release file using grep or cat command. Systemd based Linux distro users can use the hostnamectl command.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
How to check your Linux version: easy ways to view the distribution and version number
When most people think of Linux, an open source operating system that serves as an alternative to Microsoft and Apple comes to mind. But unlike these market leaders that offer commercial operating systems, there is no single Linux operating system.
Instead, there is a whole series of free, open-source operating systems (referred to as “distributions”) that are built based on the Linux kernel. This means that Linux merely serves as the basis for potential operating systems, which are then built from the kernel and other programming elements. While Microsoft and Apple release closed-source, proprietary software products, the Linux kernel is open-source code that any member of the Linux community can use or modify to make their own applications and operating systems.
Since there exist countless Linux versions, it’s of utmost importance to know which version you’re running, especially when you run into technical problems, have questions, or want to do an update. Luckily, it’s very easy to find out. Keep reading for instructions on how tocheck your Linux version.
Linux version: what do the distribution and version number mean?
As of June 2020, there are now over 500 unique Linux distributions. The best-known are Ubuntu, Debian, Fedora, SUSE, Manjaro, and Linux Mint.
The family tree for Ubuntu alone contains over 65 software applications built on the basis of Ubuntu. The current distribution was released in 2020 with the version number 20.04. The first version of Ubuntu came out in 2004 and was based on the Debian operating system.
The various Linux distributions can be roughly divided into three basic family trees as well as countless other smaller branches and independent versions. For example, the entire Ubuntu family is based on Debian, the distribution Fedora is based on Red Hat Linux, and SUSE used Slackware.
Even though they’re all based on the Linux kernel, the various distributions serve as their own operating systems with different GNU toolchains and graphic interfaces. In order to find your way in the busy Linux landscape, it’s important to know which version of the Linux kernel and which distribution you’re using.
Checking the Linux version in the terminal
Whether you’re using Linux privately or professionally, it’s always important to know which Linux version and distribution you’re working with. That way you’ll know which package manager you’ll need for downloading new tools and updates, and which Linux forum you should turn to when you have questions or experience problems.
If you’re looking for details about your Linux version, there are two words which will be of particular significance:
- The version number of the distribution
- The version of the Linux kernel
To find out these two values, you’ll need to use Linux commands. In general, when working in Linux, user input is entered into so-called “shells”, which are interfaces between systems and users. Shells run using a graphic terminal that processes the commands in the relevant programming language. This will serve as your starting point in checking your Linux version.
Step 1: Distribution version number
Open the Linux terminal with the keys [Ctrl] + [Alt] + [T] or by using the search function. Type the following command into the terminal and then press enter:
The asterisk in the code ensures that the command will apply to all distributions and shows you the installed version. The data that you see now may look a bit messy, with some lines appearing twice or several ending in “release”. The most important line here is “PRETTY_NAME=”, which contains the name of the distribution and version number that you’re currently using.
Another command that works on all distributions without the need for a special tool is the following:
If you only need the name and version number of your current distribution, the following command will suffice:
In the following example, you can see that Ubuntu 20.04 LTS is currently running:
The command “lsb_release -d” shows the current distribution and its version number.
The following command lists more comprehensive information about the version:
The command “lsb_release -a” shows additional information about the distribution version you’re currently running.
This command should work on every Linux distribution, as long as you’ve installed the lsb-release package or it’s part of your Ubuntu version. If you haven’t already installed it, you can easily do so with the following command for Debian and Ubuntu:
Step 2: Linux kernel version number
If you’d like to know which version of the Linux kernel you’re using, type the following command into the terminal and press enter:
The command “uname -r” shows the version of the Linux kernel that you’re currently using.
You’ll now see which Linux kernel you’re using. In the above example, the Linux kernel is 5.4.0-26.
If you’d like to see more information (about computer architecture for example), you can enter the following command:
The command “uname -a” shows the version of the Linux kernel you’re using, as well as additional details.
Step 3: View everything at once with Inxi
With the tool Inxi, you can easily view all the information about your hardware, host, Linux kernel, desktop environment, and distribution. To install the program in Debian/Ubuntu, enter the following command into the terminal:
Once installed, you can view the above-mentioned data with this simple command:
- 16.10.20
- Know-how
- How did you like the article? 0
How to check Debian version: the quick and easy way
Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.
How to check your Ubuntu version: a guide
Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.
Remove a directory in Linux: a simple guide
Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.
Deleting files in Linux: a how-to guide
Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command “rm”, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.
Linux find command: search and find files
While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.
Источник
How to know which Linux Distribution I’m using? [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed 11 years ago .
How to know which Linux Distribution I’m using?
uname -a gives Linux xxxxxx.net 2.6.9-42.0.3.EL.wh1smp #1 SMP Fri Aug 14 15:48:17 MDT 2009 i686 i686 i386 GNU/Linux How can I know this is Ubuntu/Debian/Fedora or Redhat?
I uses /etc/init.d/serviced restart for restarting serevices, seems it is not Redhat family
6 Answers 6
You could also try /etc/*-version
]$ cat /etc/*-release cat: /etc/*-release: No such file or directory [itflux][
]$ cat /etc/*-version cat: /etc/*-version: No such file or directory
If you have lsb_release command,
will tell you (or just use lsb_release -i ).
Edit: Looks like you’re on a Red Hat system. A google search on your uname output suggests so. This is not programmatic, of course!
/etc/issue or /etc/issue.net give a good clue. Newer distros provide /etc/lsb-release which make it easier to determine exact strings progmatically, i.e. distro name / major & minor release / web site, etc.
In the absence of /etc/lsb-release, its much more difficult, hence the creation of lsb-release.
As Alok said, it looks like you are on a rather ancient (or extremely sparse) system. I don’t think this is a case that you can (reliably) progmatically determine with a few lines of code.
If all else fails, check to see what kind of package manager is in use (apt / rpm / others), check to see if /etc/init.d is a symlink (rpm / RH distros) or a directory (debian based distros) .. and you have a pretty good clue as to what you can expect to be present in the root file system as far as structure.
Источник
Visual Studio Code on Linux
Installation
See the Download Visual Studio Code page for a complete list of available installation options.
By downloading and using Visual Studio Code, you agree to the license terms and privacy statement.
Debian and Ubuntu based distributions
The easiest way to install Visual Studio Code for Debian/Ubuntu based distributions is to download and install the .deb package (64-bit), either through the graphical software center if it’s available, or through the command line with:
Note that other binaries are also available on the VS Code download page.
Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the system’s package manager. Alternatively, the repository and key can also be installed manually with the following script:
Then update the package cache and install the package using:
RHEL, Fedora, and CentOS based distributions
We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository:
Then update the package cache and install the package using dnf (Fedora 22 and above):
Or on older versions using yum :
Due to the manual signing process and the system we use to publish, the yum repo may lag behind and not get the latest version of VS Code immediately.
Visual Studio Code is officially distributed as a Snap package in the Snap Store:
You can install it by running:
Once installed, the Snap daemon will take care of automatically updating VS Code in the background. You will get an in-product update notification whenever a new update is available.
Note: If snap isn’t available in your Linux distribution, please check the following Installing snapd guide, which can help you get that set up.
Learn more about snaps from the official Snap Documentation.
openSUSE and SLE-based distributions
The yum repository above also works for openSUSE and SLE-based systems, the following script will install the key and repository:
Then update the package cache and install the package using:
AUR package for Arch Linux
To get more information about the installation from the AUR, please consult the following wiki entry: Install AUR Packages.
Nix package for NixOS (or any Linux distribution using Nix package manager)
There is a community maintained VS Code Nix package in the nixpkgs repository. In order to install it using Nix, set allowUnfree option to true in your config.nix and execute:
Installing .rpm package manually
The VS Code .rpm package (64-bit) can also be manually downloaded and installed, however, auto-updating won’t work unless the repository above is installed. Once downloaded it can be installed using your package manager, for example with dnf :
Note that other binaries are also available on the VS Code download page.
Updates
VS Code ships monthly and you can see when a new release is available by checking the release notes. If the VS Code repository was installed correctly, then your system package manager should handle auto-updating in the same way as other packages on the system.
Note: Updates are automatic and run in the background for the Snap package.
Node.js
Node.js is a popular platform and runtime for easily building and running JavaScript applications. It also includes npm, a Package Manager for Node.js modules. You’ll see Node.js and npm mentioned frequently in our documentation and some optional VS Code tooling requires Node.js (for example, the VS Code extension generator).
If you’d like to install Node.js on Linux, see Installing Node.js via package manager to find the Node.js package and installation instructions tailored to your Linux distribution. You can also install and support multiple versions of Node.js by using the Node Version Manager.
To learn more about JavaScript and Node.js, see our Node.js tutorial, where you’ll learn about running and debugging Node.js applications with VS Code.
Setting VS Code as the default text editor
xdg-open
You can set the default text editor for text files ( text/plain ) that is used by xdg-open with the following command:
Debian alternatives system
Debian-based distributions allow setting a default editor using the Debian alternatives system, without concern for the MIME type. You can set this by running the following and selecting code:
If Visual Studio Code doesn’t show up as an alternative to editor , you need to register it:
Windows as a Linux developer machine
Another option for Linux development with VS Code is to use a Windows machine with the Windows Subsystem for Linux (WSL).
Windows Subsystem for Linux
With WSL, you can install and run Linux distributions on Windows. This enables you to develop and test your source code on Linux while still working locally on a Windows machine. WSL supports Linux distributions such as Ubuntu, Debian, SUSE, and Alpine available from the Microsoft Store.
When coupled with the Remote — WSL extension, you get full VS Code editing and debugging support while running in the context of a Linux distro on WSL.
See the Developing in WSL documentation to learn more or try the Working in WSL introductory tutorial.
Next steps
Once you have installed VS Code, these topics will help you learn more about it:
- Additional Components — Learn how to install Git, Node.js, TypeScript, and tools like Yeoman.
- User Interface — A quick orientation to VS Code.
- User/Workspace Settings — Learn how to configure VS Code to your preferences through settings.
Common questions
Azure VM Issues
I’m getting a «Running without the SUID sandbox» error?
You can safely ignore this error.
Debian and moving files to trash
If you see an error when deleting files from the VS Code Explorer on the Debian operating system, it might be because the trash implementation that VS Code is using is not there.
Run these commands to solve this issue:
Conflicts with VS Code packages from other repositories
Some distributions, for example Pop!_OS provide their own code package. To ensure the official VS Code repository is used, create a file named /etc/apt/preferences.d/code with the following content:
«Visual Studio Code is unable to watch for file changes in this large workspace» (error ENOSPC)
When you see this notification, it indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files. Before adjusting platform limits, make sure that potentially large folders, such as Python .venv , are added to the files.watcherExclude setting (more details below). The current limit can be viewed by running:
The limit can be increased to its maximum by editing /etc/sysctl.conf (except on Arch Linux, read below) and adding this line to the end of the file:
The new value can then be loaded in by running sudo sysctl -p .
While 524,288 is the maximum number of files that can be watched, if you’re in an environment that is particularly memory constrained, you may want to lower the number. Each file watch takes up 1080 bytes, so assuming that all 524,288 watches are consumed, that results in an upper bound of around 540 MiB.
Arch-based distros (including Manjaro) require you to change a different file; follow these steps instead.
Another option is to exclude specific workspace directories from the VS Code file watcher with the files.watcherExclude setting. The default for files.watcherExclude excludes node_modules and some folders under .git , but you can add other directories that you don’t want VS Code to track.
I can’t see Chinese characters in Ubuntu
We’re working on a fix. In the meantime, open the application menu, then choose File > Preferences > Settings. In the Text Editor > Font section, set «Font Family» to Droid Sans Mono, Droid Sans Fallback . If you’d rather edit the settings.json file directly, set editor.fontFamily as shown:
Package git is not installed
This error can appear during installation and is typically caused by the package manager’s lists being out of date. Try updating them and installing again:
The code bin command does not bring the window to the foreground on Ubuntu
Running code . on Ubuntu when VS Code is already open in the current directory will not bring VS Code into the foreground. This is a feature of the OS which can be disabled using ccsm .
Under General > General Options > Focus & Raise Behaviour, set «Focus Prevention Level» to «Off». Remember this is an OS-level setting that will apply to all applications, not just VS Code.
Cannot install .deb package due to «/etc/apt/sources.list.d/vscode.list: No such file or directory»
This can happen when sources.list.d doesn’t exist or you don’t have access to create the file. To fix this, try manually creating the folder and an empty vscode.list file:
Cannot move or resize the window while X forwarding a remote window
If you are using X forwarding to use VS Code remotely, you will need to use the native title bar to ensure you can properly manipulate the window. You can switch to using it by setting window.titleBarStyle to native .
Using the custom title bar
The custom title bar and menus were enabled by default on Linux for several months. The custom title bar has been a success on Windows, but the customer response on Linux suggests otherwise. Based on feedback, we have decided to make this setting opt-in on Linux and leave the native title bar as the default.
The custom title bar provides many benefits including great theming support and better accessibility through keyboard navigation and screen readers. Unfortunately, these benefits do not translate as well to the Linux platform. Linux has a variety of desktop environments and window managers that can make the VS Code theming look foreign to users. For users needing the accessibility improvements, we recommend enabling the custom title bar when running in accessibility mode using a screen reader. You can still manually set the title bar with the Window: Title Bar Style ( window.titleBarStyle ) setting.
Broken cursor in editor with display scaling enabled
Due to an upstream issue #14787 with Electron, the mouse cursor may render incorrectly with scaling enabled. If you notice that the usual text cursor is not being rendered inside the editor as you would expect, try falling back to the native menu bar by configuring the setting window.titleBarStyle to native .
Repository changed its origin value
If you receive an error similar to the following:
Use apt instead of apt-get and you will be prompted to accept the origin change:
Источник