i have learnt the following from youtube video’s, lbry videos and google searches. Another way is the use the man command in linux which stands for manual type man ls and it will output the manual in the command line to quit the manual just press q on your keyboard.
The first thing I learned was the ls command which stands for list files. If you type ls it will list the files and folders in the current directory you are in. For example, if you are in the /home directory it will list all the users home folders that are in that home directory. you can also add options to the ls command by putting a space and then a – and then the option.
For example if I wanted to list the files & folders with some extra information like file sizes or permissions or date modified I would type ls -l
this would give me the information i needed but if i wanted to make it so i could read the infomration abit easier i would add the h option for example ls -lh this would output the same as the ls-l command but output the file or folder sizes in a easier way to read.
Below are the an example of the command and also an image of my terminal running the commands.
ls = LISTS THE FILES AND FOLDERS IN CURRENT DIRECTORY ls -l = SAME AS ABOVE WITH DETAILS OF THE FILES & FOLDERS ls -lh = SAME AS ABOVE WITH READABLE FILE SIZES
In this example, I have 1 user which is called mason64 and you can see from the ls -lh command the directory size because its a new install is only 4.0k which basically means I have no data on mason64 user profile as of yet.
Extra options you may find handy are the following:-
ls -a = LISTS ALL THE FILES & FOLDERS INCLUDING ANY HIDDEN ls -A = SAME AS THE ABOVE BUT DOES NOT LIST IMPLIED . AND .. ls -B = LISTS THE FILES AND FOLDERS BUT IGNORES BACKUPS (ENDING WITH ~)
From what i can see most of these can be used together for example if i wanted to list all files and folders and any hidden files with backups being ignored outputted in a list and make the file sizes readable i could use the following command
- To summarize
show everything even hidden files and directories
Show all files and directories but do not list implied . and ..
Another command that i couldnt see in the man page is ll (that is two lowercase L’s)the command ll lists all files and directoies in your current directory including any hidden files. am not sure what ll stands for but if you know please let me know so i can edit this post :).
Basic stuff but things i didnt know about until i wrote this post and i am glad i did so i can keep coming back to it if i ever need to know what some of these commands or options do.
Thanks for reading