Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From the above I'm clearly a newbie and a windows user.
My simple question is: what is the absolutely easiest way to have some kind of script so the "DIR: on the command line displays the current Linux directory as in windows. I'm currently using the Edison "Yocto" Linux version. As a windows user - - - not wishing to flame --- I find the Linux command line names totally scrambled letters. How for example does "df" get to be show the current directory? Has anybody out there written a type of script that makes it easy for Windows/DOS "die-hards" to use their favorite commands like dir, copy, erase, show, type….. in Linux.
From the above I'm clearly a newbie and a windows user.
My simple question is: what is the absolutely easiest way to have some kind of script so the "DIR: on the command line displays the current Linux directory as in windows. I'm currently using the Edison "Yocto" Linux version. As a windows user - - - not wishing to flame --- I find the Linux command line names totally scrambled letters. How for example does "df" get to be show the current directory? Has anybody out there written a type of script that makes it easy for Windows/DOS "die-hards" to use their favorite commands like dir, copy, erase, show, type….. in Linux.
John
Hi and welcome!
df does not show the current directory, pwd does however. Like the first answer says, you can alias commands to point to other commands.
For example, the aliases in my .bashrc under Arch Linux looks like this:
Code:
alias rm='rm -i'
alias grep='grep --color=auto'
alias mv='mv -v'
alias cp='cp -v'
alias wm='sudo wifi-menu'
So, you could for instance make an alias that looks like this:
Code:
alias Dir='pwd'
Then when you enter Dir on the command line, you will in reality run pwd and get your current working directory.
Thanks guy's that helps a bit, the alias dir='ls -l' seem to be the closest. The first picture below is what I get.
It sort of gives me more information than I (normally) need. Is there a program out there that lists just the file names and the sub directories with something like a “/” in front of the sub directory? For example the Edison "Yocto" Linux version of "df" is shown in the second picture below
BTW there does not seem to be a “man ls” command. What is the equivalent of “Help xxx” in Linux?
Finally is there a logic to the letters used and the commands in Linux. How does one get show the directory from “ls”?
Please excuse the basic questions – these I think would be typical of a first time windows user.
files and sub-directories... try "ls -R" and see how this looks to you. It can get very messy but perhaps i missunderstand what you are trying to achieve.
BTW there does not seem to be a “man ls” command. What is the equivalent of “Help xxx” in Linux?
Finally is there a logic to the letters used and the commands in Linux. How does one get show the directory from “ls”?
Please excuse the basic questions – these I think would be typical of a first time windows user.
The man command is the Linux equivalent of help I would have expected all distributions to have it unless you are running a minimal installation. You could also try the info command. If you search google for "basic linux commands" you will probably find some explanations for the names. I didn't really think about it much but to me ls looks like it means LiSt, cp is CoPy, mv is MoVe.
Is there a program out there that lists just the file names and the sub directories with something like a “/” in front of the sub directory? For example the Edison "Yocto" Linux version of "df" is shown in the second picture below
Code:
du -h --max-depth=1
This will give you a listing of your directories with a forward ./ in front of them along with a human readabe directory size on the left column.
Code:
ls -1F
This will give you a single column listing of your files and directories with a forward slash after a directory name.
Whichever code you use, pipe the code to either more or less because without it, the output will zoom quickly on the screen.
Code:
du -h --max-depth=1 | more
or
du -h --max-depth=1 | less
Many Linux programs will display an abbreviated help, abbreviated when compared to the man page, when you enter the program name followed by "--help." For example:
Code:
~$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them; e.g.,
'--block-size=M' prints sizes in units of
1,048,576 bytes; see SIZE format
(remainder of output omitted)
As an aside, I would suggest that learning native Linux commands is ultimately the best way to learn Linux. My experience has been that native Linux commands are more versatile and powerful than their Windows equivalents. Just my two cents.
From the above I'm clearly a newbie and a windows user.
My simple question is: what is the absolutely easiest way to have some kind of script so the "DIR: on the command line displays the current Linux directory as in windows. I'm currently using the Edison "Yocto" Linux version. As a windows user - - - not wishing to flame --- I find the Linux command line names totally scrambled letters. How for example does "df" get to be show the current directory? Has anybody out there written a type of script that makes it easy for Windows/DOS "die-hards" to use their favorite commands like dir, copy, erase, show, type….. in Linux.
John
Try this pdf file it's quite clear on its explanation.
Looks like I not out of the woods yet, Today I brought up the Edison/Linux board and found to my delight that my alias for dir=’ls –A –B –F –g –h’ worked fine (no matter where is was in the disk files tree).
Excited today I tried for some other DOS/CPM commands like:-
Alias copy=’cp -I –r’
Alias stat=’df –H’
They seemed to work fine. However what I cannot understand is when I reboot the system they are no longer recognized – yet the original dir alias works. I tried doing the above two alias’es in the top directory by using cd / still no luck.
Help please
John
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
It may be better to start getting used to using ls that way if you reinstall and forget to have your alias set up (for example) you'll still know what you're doing. I seem to recall that PowerShell will allow the use of ls on Windows (seem to recall using it in command prompt before that but not sure) so you can even take that habit back to modern Windows.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.