2018-10-12 04:30:38 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: Bash ls
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Bash ls
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`ls`  is a command on Unix-like operating systems to list contents of a directory, for example folder and file names. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Usage
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```bash
							 
						 
					
						
							
								
									
										
										
										
											2018-10-28 04:02:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ls [options] [folder_path]
							 
						 
					
						
							
								
									
										
										
										
											2018-10-12 04:30:38 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2018-10-14 02:27:00 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You can list the items in any directory without even entering the directory. Consider you are in a directory with folders- Test1,Test2. You're in the parent directory you can list all files in Test1 as follows-
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`ls Test1`  
						 
					
						
							
								
									
										
										
										
											2018-10-12 04:30:38 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Most used options:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `-a` , all files and folders, including ones that are hidden and start with a `.`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `-l` , List in long format 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `-G` , enable colorized output. 
						 
					
						
							
								
									
										
										
										
											2018-10-15 22:42:19 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `-s` , List File Size. 
						 
					
						
							
								
									
										
										
										
											2018-10-25 14:08:54 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `-R` , displays the contents of the directory, and its subdirectories. 
						 
					
						
							
								
									
										
										
										
											2018-10-12 04:30:38 +05:30 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Example:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								List files in `freeCodeCamp/guide/` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ls                                                                ⚬ master
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CODE_OF_CONDUCT.md bin                package.json       utils
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								CONTRIBUTING.md    gatsby-browser.js  plugins            yarn.lock
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								LICENSE.md         gatsby-config.js   src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								README.md          gatsby-node.js     static
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								assets             gatsby-ssr.js      translations
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### More Information:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  [Wikipedia ](https://en.wikipedia.org/wiki/Ls ) 
						 
					
						
							
								
									
										
										
										
											2018-10-23 15:10:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  [Shapeshed ](https://shapeshed.com/unix-ls/ )