- 5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit
- 1. uname Command
- 2. dpkg Command
- 3. getconf Command
- 4. arch Command
- 5. file Command
- Conclusion
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Related Posts
- 11 thoughts on “5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit”
- Поиск в Linux с помощью команды find
- Общий синтаксис
- Описание опций
- Примеры использования find
- Поиск файла по имени
- Поиск по дате
- По типу
- Поиск по правам доступа
- Поиск файла по содержимому
- С сортировкой по дате модификации
- Лимит на количество выводимых результатов
- Поиск с действием (exec)
- Чистка по расписанию
- How do I know if my Linux is 32 bit or 64 bit?
- How do I know if my Linux is 32 bit or 64 bit?
- Find out CPU is 32bit or 64bit on a Linux system
- How do I know if my Linux is 32 bit or 64 bit?
- Other Linux command to check if I have a 32-bit or a 64-bit OS
- A note about GUI method
- Use the lshw command
5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit
This tutorial describes how to find out whether your Linux system’s OS is 32-bit or 64-bit. This will be helpful if you wanted to download or install an application in your Linux system. As we all know, we can’t install 64-bit applications into a 32-bit OS type. That’s why knowing your Linux system’s OS type is important.
Check Linux System is 32-bit or 64-bit
Here are the five easy and simple methods to verify your Linux system’s OS type. It doesn’t matter whether you’re using a GUI or CLI type systems, the following commands will work on almost all Linux operating systems such as RHEL, CentOS, Fedora, Scientific Linux, Debian, Ubuntu, Linux Mint, openSUSE etc.
1. uname Command
uname -a command will display your Linux system’s OS type. This is the universal command and it will work on almost all Linux/Unix operating systems.
To find out the system’s OS type, run:
2. dpkg Command
dpkg command will also display whether your Debian/Ubuntu operating system is 32-bit or 64-bit. This command will work only on Debian and Ubuntu based distributions and it’s derivatives.
Open your Terminal, and run:
If your OS is 64-bit, you’ll get the following output:
If your OS is 32-bit, then the output will be:
3. getconf Command
getconf command will also display the system configuration variables. Now, let me show you how to find out the Linux system arch using getconf command.
For more details refer the man pages.
4. arch Command
arch command will display your OS type. This command is similar to uname -m command. If its output is x86_64 then it’s 64-bit OS. If the output is i686 or i386, then it’s 32-bit OS.
5. file Command
file command with with a special argument /sbin/init will display the OS type.
Conclusion
You now know the ways to find out your Linux operating system’s type. Of course, there are few other ways to find out the OS type, but these are the often and pragmatic methods so far. If you know any other commands or methods to display the OS type, feel free to let us know in the comments section below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Related Posts
11 thoughts on “5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit”
I’d just like to interject for a moment. What you’re referring to as Linux, is in fact, GNU/Linux, or as I’ve recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called “Linux”, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine’s resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called “Linux” distributions are really distributions of GNU/Linux.
You can also check using a environment variable:
Источник
Поиск в Linux с помощью команды find
Утилита find представляет универсальный и функциональный способ для поиска в Linux. Данная статья является шпаргалкой с описанием и примерами ее использования.
Общий синтаксис
— путь к корневому каталогу, откуда начинать поиск. Например, find /home/user — искать в соответствующем каталоге. Для текущего каталога нужно использовать точку «.».
— набор правил, по которым выполнять поиск.
* по умолчанию, поиск рекурсивный. Для поиска в конкретном каталоге можно использовать опцию maxdepth.
Описание опций
Опция | Описание |
---|---|
-name | Поиск по имени. |
-iname | Регистронезависимый поиск по имени. |
-type | |
-size | Размер объекта. Задается в блоках по 512 байт или просто в байтах (с символом «c»). |
-mtime | Время изменения файла. Указывается в днях. |
-mmin | Время изменения в минутах. |
-atime | Время последнего обращения к объекту в днях. |
-amin | Время последнего обращения в минутах. |
-ctime | Последнее изменение владельца или прав на объект в днях. |
-cmin | Последнее изменение владельца или прав в минутах. |
-user | Поиск по владельцу. |
-group | По группе. |
-perm | С определенными правами доступа. |
-depth | Поиск должен начаться не с корня, а с самого глубоко вложенного каталога. |
-maxdepth | Максимальная глубина поиска по каталогам. -maxdepth 0 — поиск только в текущем каталоге. По умолчанию, поиск рекурсивный. |
-prune | Исключение перечисленных каталогов. |
-mount | Не переходить в другие файловые системы. |
-regex | По имени с регулярным выражением. |
-regextype | Тип регулярного выражения. |
-L или -follow | Показывает содержимое символьных ссылок (симлинк). |
-empty | Искать пустые каталоги. |
-delete | Удалить найденное. |
-ls | Вывод как ls -dgils |
Показать найденное. | |
-print0 | Путь к найденным объектам. |
-exec <> \; | Выполнить команду над найденным. |
-ok | Выдать запрос перед выполнением -exec. |
Также доступны логические операторы:
Оператор | Описание |
---|---|
-a | Логическое И. Объединяем несколько критериев поиска. |
-o | Логическое ИЛИ. Позволяем команде find выполнить поиск на основе одного из критериев поиска. |
-not или ! | Логическое НЕ. Инвертирует критерий поиска. |
Полный набор актуальных опций можно получить командой man find.
Примеры использования find
Поиск файла по имени
1. Простой поиск по имени:
find / -name «file.txt»
* в данном примере будет выполнен поиск файла с именем file.txt по всей файловой системе, начинающейся с корня /.
2. Поиск файла по части имени:
* данной командой будет выполнен поиск всех папок или файлов в корневой директории /, заканчивающихся на .tmp
3. Несколько условий.
а) Логическое И. Например, файлы, которые начинаются на sess_ и заканчиваются на cd:
find . -name «sess_*» -a -name «*cd»
б) Логическое ИЛИ. Например, файлы, которые начинаются на sess_ или заканчиваются на cd:
find . -name «sess_*» -o -name «*cd»
в) Более компактный вид имеют регулярные выражения, например:
find . -regex ‘.*/\(sess_.*cd\)’
* где в первом поиске применяется выражение, аналогичное примеру а), а во втором — б).
4. Найти все файлы, кроме .log:
find . ! -name «*.log»
* в данном примере мы воспользовались логическим оператором !.
Поиск по дате
1. Поиск файлов, которые менялись определенное количество дней назад:
find . -type f -mtime +60
* данная команда найдет файлы, которые менялись более 60 дней назад.
2. Поиск файлов с помощью newer. Данная опция доступна с версии 4.3.3 (посмотреть можно командой find —version).
а) дате изменения:
find . -type f -newermt «2019-11-02 00:00»
* покажет все файлы, которые менялись, начиная с 02.11.2019 00:00.
find . -type f -newermt 2019-10-31 ! -newermt 2019-11-02
* найдет все файлы, которые менялись в промежутке между 31.10.2019 и 01.11.2019 (включительно).
б) дате обращения:
find . -type f -newerat 2019-10-08
* все файлы, к которым обращались с 08.10.2019.
find . -type f -newerat 2019-10-01 ! -newerat 2019-11-01
* все файлы, к которым обращались в октябре.
в) дате создания:
find . -type f -newerct 2019-09-07
* все файлы, созданные с 07 сентября 2019 года.
find . -type f -newerct 2019-09-07 ! -newerct «2019-09-09 07:50:00»
* файлы, созданные с 07.09.2019 00:00:00 по 09.09.2019 07:50
По типу
Искать в текущей директории и всех ее подпапках только файлы:
* f — искать только файлы.
Поиск по правам доступа
1. Ищем все справами на чтение и запись:
find / -perm 0666
2. Находим файлы, доступ к которым имеет только владелец:
find / -perm 0600
Поиск файла по содержимому
find / -type f -exec grep -i -H «content» <> \;
* в данном примере выполнен рекурсивный поиск всех файлов в директории / и выведен список тех, в которых содержится строка content.
С сортировкой по дате модификации
find /data -type f -printf ‘%TY-%Tm-%Td %TT %p\n’ | sort -r
* команда найдет все файлы в каталоге /data, добавит к имени дату модификации и отсортирует данные по имени. В итоге получаем, что файлы будут идти в порядке их изменения.
Лимит на количество выводимых результатов
Самый распространенный пример — вывести один файл, который последний раз был модифицирован. Берем пример с сортировкой и добавляем следующее:
find /data -type f -printf ‘%TY-%Tm-%Td %TT %p\n’ | sort -r | head -n 1
Поиск с действием (exec)
1. Найти только файлы, которые начинаются на sess_ и удалить их:
find . -name «sess_*» -type f -print -exec rm <> \;
* -print использовать не обязательно, но он покажет все, что будет удаляться, поэтому данную опцию удобно использовать, когда команда выполняется вручную.
2. Переименовать найденные файлы:
find . -name «sess_*» -type f -exec mv <> new_name \;
find . -name «sess_*» -type f | xargs -I ‘<>‘ mv <> new_name
3. Вывести на экран количество найденных файлов и папок, которые заканчиваются на .tmp:
find . -name «*.tmp» | wc -l
4. Изменить права:
find /home/user/* -type d -exec chmod 2700 <> \;
* в данном примере мы ищем все каталоги (type d) в директории /home/user и ставим для них права 2700.
5. Передать найденные файлы конвееру (pipe):
find /etc -name ‘*.conf’ -follow -type f -exec cat <> \; | grep ‘test’
* в данном примере мы использовали find для поиска строки test в файлах, которые находятся в каталоге /etc, и название которых заканчивается на .conf. Для этого мы передали список найденных файлов команде grep, которая уже и выполнила поиск по содержимому данных файлов.
6. Произвести замену в файлах с помощью команды sed:
find /opt/project -type f -exec sed -i -e «s/test/production/g» <> \;
* находим все файлы в каталоге /opt/project и меняем их содержимое с test на production.
Чистка по расписанию
Команду find удобно использовать для автоматического удаления устаревших файлов.
Открываем на редактирование задания cron:
0 0 * * * /bin/find /tmp -mtime +14 -exec rm <> \;
* в данном примере мы удаляем все файлы и папки из каталога /tmp, которые старше 14 дней. Задание запускается каждый день в 00:00.
* полный путь к исполняемому файлу find смотрим командой which find — в разных UNIX системах он может располагаться в разных местах.
Источник
How do I know if my Linux is 32 bit or 64 bit?
Let us see all commands to Find if Linux is running on 32-bit or 64-bit systems.
How do I know if my Linux is 32 bit or 64 bit?
To know information about the CPU architecture, type the following lscpu command:
lscpu
From the above output it is clear that I have:
- CPU: AMD Ryzen 7 1700 Eight-Core Processor
- Architecture: x86_64
- CPU can run: 32bit or 64-bit operating system
Find out CPU is 32bit or 64bit on a Linux system
Simply run the following grep command:
grep -o -w ‘lm’ /proc/cpuinfo | sort -u
Sample outputs:
The lm flag means long mode cpu i.e. 64 bit CPU. For more info type the following cat command to get complete info on your CPU:
cat /proc/cpuinfo
cat /proc/cpuinfo | more
How do I know if my Linux is 32 bit or 64 bit?
Now you know you have an AMD CPU that can run both 32bit and 64 bit operating systems. But, how do I know if my current kernel and Linux distro are 64-bit or 32-bit? Fear not, run the following command:
getconf LONG_BIT
The getconf command checks if the Linux kernel is 32 bit or 64 bit. The 64 means I am running 64 bit Linux kernel and Linux distro.
Other Linux command to check if I have a 32-bit or a 64-bit OS
Run the following uname command:
uname -i
For 64bit you will get x86_64 and i386 for 32bit Intel CPU.
A note about GUI method
Open your Linux distros, System Settings window, and select the Details:
Use the lshw command
Execute the following lshw command to list all info about CPU:
sudo lshw -c cpu
Sample outputs:
Источник