How to display a simple list of all disks like this dev sda dev sdb

0 votes

I am trying to run these Linux commands and wanted to get a simple list of all disks, which is like this  /dev/sda /dev/sdb ?

Can someone tell me how to get it?

Thanks

Jul 12, 2018 in Linux Administration by Fairyprincess
• 160 points
5,429 views

1 answer to this question.

0 votes

You can list all the disk in system by following way. Lets have a look,

ls : Show Individual partitions.

# ls /dev/sd* /dev/sda /dev/sda1

ls: just disks, ignore partitions

# ls /dev/sd*[a-z]
/dev/sda

fdisk : 

# fdisk -l 2>/dev/null |awk '/^Disk \//{print substr($2,0,length($2)-1)}'
/dev/xvda
These are ways where you will get a list of disk present in your system.
answered Jul 12, 2018 by DearestOne
• 200 points

Related Questions In Linux Administration

0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 5, 2020 in Linux Administration by Prakash K. Aithal
2,932 views
0 votes
1 answer

How to check permissions of a file in the Linux system?

Hi@akhtar, If you prefer using the command line, ...READ MORE

answered Aug 13, 2020 in Linux Administration by MD
• 95,460 points
1,723 views
0 votes
1 answer

How to check permissions of a folder in the Linux system?

Hi@akhtar, You can use ls command to check ...READ MORE

answered Aug 13, 2020 in Linux Administration by MD
• 95,460 points
9,676 views
0 votes
1 answer

How to give the read power of a folder in Linux system?

Hi@akhtar, You can use chmod command in your ...READ MORE

answered Aug 13, 2020 in Linux Administration by MD
• 95,460 points
1,024 views
0 votes
1 answer

How to change the group of a folder in Linux system?

Hi@akhtar, You can use chgrp command in your ...READ MORE

answered Aug 14, 2020 in Linux Administration by MD
• 95,460 points
1,338 views
0 votes
1 answer

How to gather CPU architecture information of a Linux system?

Hi@akhtar, You can use lscpu command to check ...READ MORE

answered Oct 12, 2020 in Linux Administration by MD
• 95,460 points
638 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
1,152 views
0 votes
1 answer

What are the basic commands used for user management?

The basic commands used for user management ...READ MORE

answered Mar 8, 2019 in Others by Nabarupa
701 views
0 votes
2 answers

Install postgreSQL on Ubuntu

Follow the below commands to install PostgreSQL (PSQL) ...READ MORE

answered Nov 12, 2020 in Database by Prachi
• 140 points
1,221 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP