• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

Roger Perkin

Network Automation Architect

  • Network Automation
    • Network Automation Courses
    • What is NetDevOps?
    • Workflow Orchestration
    • Ansible Automation Platform
    • Ansible Workshop
    • What is Network Automation?
    • Network Automation Tools
    • ContainerLab
    • Ansible Training
      • What is Ansible?
      • Ansible Tutorial for Beginners
      • Ansible Network Automation
      • Ansible Inventory Example
    • Python Network Automation
      • Nornir
      • Python Network Automation Course
      • Python for Network Engineers
      • Python VENV / Virtual Environment Tutorial
      • Python Tutorial for Beginners
      • pyATS
    • Network Source of Truth
      • NetBox
      • Infrahub
    • NetDevops
    • DevOps Tutorial
      • Git Training
      • Terraform Training
      • Linux Training
      • Kubernetes Training
      • Devops Training Course
      • Azure Devops Training
    • Terraform
    • GIT
      • Git Commands
      • What is GitHub?
    • Docker Training
    • Confluence
    • Microsoft Azure
  • Cisco
    • ISE
    • SD WAN Training
    • Password Recovery
    • Software-Upgrade-Guides
    • BGP
    • Data Center
    • WIRELESS
  • CCIE
  • Blog
  • About
    • My Red Special Guitar
  • Contact

Linux Tips & Tricks for Beginners

Home » Linux

In this post I will be listing all the Linux Tips & Tricks I come across in my journey to learn Linux.
This will be done on an Ubuntu 17.10 desktop installation, as I encounter each issue I will upload it here, mainly for my reference but also hopefully this can help someone else as well.

Delete non empty directory Linux

To delete a file in Linux you use the command rm <filename> linux will delete this file without question. To delete a a folder in Linux you use the command rmdir however you might get the following error. (Trying to delete a folder called test)

rm: cannot remove ‘test’: Is a directory

To remove a directory that contains other files or directories, use the following command.

rm -r test

In the example above, “test” is my folder I want to delete, you need to replace this with the name of the directory you want to delete. For example, if the directory was named “photos”, you would type rm -r photos at the prompt.

Executing the above command would delete all files and directories within the directory named in the command. However, it would also present a prompt for approval to delete each of the files. If you don’t want to receive a prompt for each file, use the following command instead.

rm -rf test

In the example above, the “test” directory, along with all files and directories within that directory, would be deleted with no prompt or message.

List contents of a folder with owner and permissions

If you want to see the contents of a folder you simply issue the command ls 

roger@ubuntu:/etc/ansible$ ls 
ansible.cfg backup.yml hosts switch.yml templates vxlan_spine.ios

However if you want to see more details about each file, like it’s permissions and owner then you need to use ls -l 

roger@ubuntu:/etc/ansible$ ls -l
total 40
-rw-r--r-- 1 root root 18066 Jun 1 2017 ansible.cfg
-rw-r--r-- 1 roger roger 704 Mar 27 13:17 backup.yml
-rw-r--r-- 1 root root 126 Mar 24 09:04 hosts
-rw-r--r-- 1 root root 120 Mar 24 09:08 switch.yml
drwxr-xr-x 3 root root 4096 Mar 26 00:51 templates
-rw-r--r-- 1 roger roger 39 Mar 26 10:56 vxlan_spine.ios

For even more detail of the folder, showing all files use ll

roger@ubuntu:/etc/ansible$ ll
total 60
drwxrwxrwx 4 root root 4096 Mar 27 13:17 ./
drwxr-xr-x 125 root root 12288 Mar 27 06:54 ../
-rw-r–r– 1 root root 18066 Jun 1 2017 ansible.cfg
-rw-r–r– 1 roger roger 704 Mar 27 13:17 backup.yml
drwxr-xr-x 8 roger roger 4096 Mar 27 13:19 .git/
-rw-r–r– 1 root root 126 Mar 24 09:04 hosts
-rw-r–r– 1 root root 120 Mar 24 09:08 switch.yml
drwxr-xr-x 3 root root 4096 Mar 26 00:51 templates/
-rw-r–r– 1 roger roger 39 Mar 26 10:56 vxlan_spine.ios

Here you can see a hidden folder .git which was not visible before

This command ll is sometimes (and it varies on which distro you are running) aliased to different commands

In my case running Ubuntu, ll is aliased to ls -alF 

To see this issue the following command

roger@ubuntu:/etc/ansible$ type ll
ll is aliased to `ls -alF'

This is the actual command which is being run when you type ll 

Check out this post on how to run Linux on Windows 10

Windows Subsystem for Linux – Tutorial 

Category: Linux
ansible course for network engineers
Get Access to my Ansible Course NOW
Previous Post:vmwre esxi 6.5 login screenVMware Home Lab Server Tutorial using ESXi 6.5 Free
Next Post:Network Automation Toolsnetwork automation tools featured

Sidebar

Hi I'm Roger Perkin,
Based in the UK working as a Network Automation Architect, CCIE #50038
About Roger | Twitter | Linkedin

python course for network engineers

Topics

Network Automation
Ansible
Python for Network Automation
CCIE
Cisco ISE
F5 Certification
BGP
OSPF
Network Automation Conferences
auvik promo banner
Pluralsight Trial

Git for Network Engineers

Ansible vs Nornir

Start learning today with my Network Automation Courses

Master Ansible, Python, Git, Nornir, Jenkins and more..


Buy me a coffeeBuy me a coffee

ansible network automation course

Have you seen my YouTube Channel?

YouTube Subscribe

Let’s get started

Take a look at my premium courses on Ansible, Nornir & Git or buy them all with the Network Automation Bundle!

Network Automation Courses

Navigation

Python VENV Tutorial
Python for Network Engineers

Network Automation
Network Automation Courses
Network Discovery Tools
Network Automation Conferences
Ansible Training
What is Ansible?
Devops Tutorial
Network Source of Truth
DevOps Glossary
Network Monitoring Software

Contact

Contact

Get in touch with me here

[email protected]

  • Twitter
  • LinkedIn
  • YouTube
Buy me a coffeeBuy me a coffee

Copyright © 2025 · Roger Perkin · All Rights Reserved · Privacy Policy – Terms