Posts

Showing posts with the label Ubuntu

Useful network command for Linux

  nc (netcat) command : used for port scanning, port redirection, as a port listener $ nc -v -w 2 z <ip-address> 22 #scan a single port $ nc -v -w 2 z <ip-address> 22 80 #scan multiple ports $ nc -v -w 2 z <ip-address> 20–25 #scan range of ports nmap command : Nmap is used for exploring networks, perform security scans, network audit and finding open ports on remote machine The Nmap tool offers various methods to scan a system. In this example, I am performing a scan using hostname to find out all open ports, services and MAC address on the system # nmap [Scan Type(s)] [Options] {target specification} # yum install nmap [on Red Hat based systems] $ sudo apt-get install nmap [on Debian based systems] with “-v” option is giving more detailed information about the remote machine. nmap <hostname or IP> nmap -v <IP> You can scan multiple hosts by simply writing their IP addresses or hostnames with Nmap. nmap <IP1><IP2> nmap -sU <IP...

Restore the size of USB drive in Linux

  Run  lsblk  command to find outUSB partition. In this case you see the USB flash drive is sdb so you  VERY CAREFULLY  run: #sudo dd if=/dev/zero of=/dev/sdb count=100 Create a new partition table  in the format you like: #dd if=/dev/zero of=/dev/sdb bs=32k count=1 Create mounting point: #sudo mkdir /media/external Mount the Drive:  We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point): #sudo   mount -t vfat /dev/sdb /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137 OR If the device is formatted with NTFS , run: #sudo mount -t ntfs-3g /dev/sdb1 /media/external Note: You must have the ntfs-3g driver installed Unmounting the Drive : #sudo umount /dev/sdb ENJOY

Configuring Shared Folders in VMWare Workstation with a UBUNTU Guest OS and Windows Host

Image
  Start VMWare Workstation, then power on Ubuntu guest OS Go to settings and choose select options tab ->shared Folderes go to settings->options->Shared folders 3. Add shared folder created on the windows machine with full access and should be always enabled choose Shared Folder 4. Go to guest OS (Ubuntu 18.0) and run the below commands (Install apt install open-vm-tools if not avialable) #sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other # vmware-hgfsclient #sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other # vmware-hgfsclient 5. Enjoy

How to set the Proxy for Docker in Linux

  Systemd Docker Service In order to the set the proxy for Docker, you will need to create a configuration file for the Docker service. No configuration files exist by default, so one will have to be created. All Systemd service configuration are stored under /etc/systemd/system. In order to keep things organized,  we can create a child directory docker.service.d, rather than creating a file called /etc/systemd/system/docker.service . Within this configuration file, we can set our HTTP and HTTPS proxy. We can also set our NO_PROXY value, too. Creating Proxy Configuration Create a new directory for our Docker service configurations. sudo mkdir -p /etc/systemd/system/docker.service.d 2. Create a file called proxy.conf in our configuration directory. sudo vi /etc/systemd/system/docker.service.d/proxy.conf 3. Add t h e following contents, changing the values to match your environment. [Service] Environment=”HTTP_PROXY=http://myproxy.hostname:8080" Environment=”HTTPS_PROXY=...