Author: ZIADI Mohamed Ali

How to show mounted devices in Linux?

To list all devices mounted in your Linux OS, you case use commands like df or mount or specific files like /proc/mounts or /proc/self/mounts or even /etc/mtab Using df command df – report file system disk space usage the popular options are: -a: all file systems -h: print sizes in human readable format (e.g., 1K 234M 2G) -T: print file system type root@server:~ # df -haT   Using mount command mount – mount a filesystem mount have many exciting options (see man mount). In our case, we will only use -l which adds the labels in the mount output. root@server:~ # mount or root@server:~ # mount -l sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,size=979900k,nr_inodes=244975,mode=755) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb) cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu) configfs on /sys/kernel/config type configfs (rw,relatime) /dev/vda1 on...

Read More

How to use Positional parameters and special variables in Linux

In bash, we have many variables. Before learning what are positional parameters and special variables we should know what are variables and how to pass them into a shell script? What are variables in Shell scripting? A variable is a value holder which we can change when it is required. We can use these variables in our shell scripts so that we no need to hard code the values with the shell script. System variables User defined variables Special variables Positional parameters Special variables We already discussed System variables, Some special variables, and command exit status in our other posts. Before learning positional we should know how we pass variables to a shell script. How to pass variables in Shell scripting? We can pass variables into shell scripts in different ways to avoid hard coding of values. We have different ways where we can pass variables to a shell script. Positional parameters are one kind of passing variables into shell scripting. Below are the way we can pass variables into shell scripting depending on what time you want to send them to a script. Within shell script(Variables defined with the script) Before start of shell script(Positional parameters) At the time of executing a shell script(using read command) What are positional parameters? Positional parameters are also called as command line arguments which we pass to the script on the fly. To understand...

Read More

Linux: Connect to your WiFi network through CLI?

In this blog, we assume that you want to connect your laptop (having a WLAN interface) to your local wifi in command-line without using the Linux Network Manager shown below First, find what wifi device you have on your machine using iw command. iw dev Example: ziadi@linuxnix:~$ iw dev phy#0 Interface wlan0 ifindex 3 wdev 0x1 addr 68:17:29:62:83:ec type managed channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz Configuring wifi though CLI on Ubuntu Linux To do that, you must modify the file /etc/network/interfaces in Linux Ubuntu /etc/network/interfaces: this file describes the network interfaces available on your system and how to activate them. Edit that file as root or sudo permissions: user@server: ~$ sudo vi /etc/network/interfaces Search for the WLAN interface and add/modify like below: # The loopback network interface auto lo iface lo inet loopback [...] auto wlan0 iface wlan0 inet dhcp wpa-ssid YOUR_WIFI_NAME wpa-psk YOUR_WIFI_PASSWORD [...] Now, restart the networking service: user@server: ~$ sudo service networking restart [....] Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfac[warn. (warning). [....] Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/wlan0/00:21:5d:7d:18:68 Sending on LPF/wlan0/00:21:5d:7d:18:68 Sending on Socket/fallback DHCPRELEASE on wlan0 to 192.168.1.1 port 67 Reloading /etc/samba/smb.conf: smbd only. Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011 Internet Systems Consortium. All rights reserved. For info, please...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.