Hot answers tagged


You could use mv -t DESTINATION file1 file2 file3 and mv -t DESTINATION `ls|grep IDENTIFIER` works, but I'm not sure if mv is invoked multiple times or not as grep will output a new line for each match.


The fundamental issue is that file expects file names as command-line arguments, not on stdin. When you write ls | file the output of ls is being passed as input to file. Not as arguments, as input. What's the difference? Command-line arguments are when you write flags and file names after a command, as in cmd arg1 arg2 arg3. In shell scripts these ...


To change your directory colors, open up your ~/.bashrc file with your editor nano ~/.bashrc and make the following entry at the end of the file: LS_COLORS=$LS_COLORS:'di=0;35:' ; export LS_COLORS Some nice color choices (in this case 0;35 it is purple) are: Blue = 34 Green = 32 Light Green = 1;32 Cyan = 36 Red = 31 Purple = 35 Brown = 33 Yellow = 1;...


The command : ls -ld .?* Will only list hidden files . Explain : -l use a long listing format -d, --directory list directory entries instead of contents, and do not derefer‐ ence symbolic links .?* will only state hidden files


dir and ls are part of coreutils and dir is almost the same as ls, just with different default options. The GNU Core Utilities are the basic file, shell and text manipulation utilities of the GNU operating system. These are the core utilities which are expected to exist on every operating system. info dir says: dir is equivalent to ls -C -b; that ...


If you want to move ABC-IDENTIFIER-XYZ.ext or IDENTIFIER-XYZ.xml, you can use: mv *IDENTIFIER* ~/YourPath/ * is a wildcard for zero or more characters, this means zero or more characters, followed by IDENTIFIER, followed by zero or more characters. This will move all the files that contain the IDENTIFIER you specified.


You can do it with find only: find . -name '*.xml' . is the current directory. If you need to search in another directory, replace . with the directory path.


Parsing ls is a Bad Idea®, prefer a simple find in that case: find . -type l -ls Credits: How do I make the shell to recognize the file names returned by a `ls -A` command, and these names contain spaces?


There's no straightforward equivalent in ls itself, but there's the less utility, which will format the output of any command as seperate pages, scrollable by line or page: ls -C | less Where -C triggers column display. Use lah as arguments (ls -lah) to get a line by line display with all files being displayed (include hidden ones), and human readable ...


The source code of ls is available for browsing online on GNU Savannah. In most cases, the required maximum width is computed (for example, using the mbswidth function for text), and then uses the classic C printf function format specifiers and some manual padding. See, for example, the functions format_user_or_group(), and gobble_file(). TL; DR: there's no ...


Short answer: ls -l gives the size of the file (= the amount of data it contains) ls -s --block-size 1 gives the size of the file on the file system Let's create two files: A sparse file of 128 bytes length (A sparse file is a file containing empty blocks, see Sparse File): # truncate -s 128 f_zeroes.img # hexdump -vC f_zeroes.img 00000000 00 00 00 ...


Try using Find sudo find . -print | grep -i '.*[.]xml'


Try to remove the funny package via sudo apt-get purge sl Check your aliases for ls e.g. in your ~/.bashrc or ~/.profile. Check the binary /usr/games/sl and delete sudo rm /usr/games/sl Check the output of strace sl |& grep execve strace ls |& grep execve if point three has no success. And in future, do NOT install anything that promises to '...


The second column is the number of hard links to the file. For a directory, the number of hard links is the number of immediate subdirectories it has plus its parent directory and itself. $ ls -n total 0 $ touch f1 $ touch f2 $ ln f1 hardlink $ ln -s f2 softlink $ mkdir d1 $ mkdir d2 $ mkdir d2/a d2/b d2/c $ ls -n total 8 drwxr-xr-x 2 1000 1000 4096 ...


tree will be very convenient for you. sudo apt-get install tree using tree filepathto list the files.


You can use grep with ls command to list all the symbolic links present in the current directory. This will list all the links present in the current directory. ls -la /var/www/ | grep "\->"


If you are just using ls with no arguments, it appears that you are using an alias for ls. To get the same output, I need to use ls -lF. From the ls manpage: -F, --classify append indicator (one of */=>@|) to entries -l use a long listing format The symbols mean the following: /: directories @: symbolic links |: FIFOs =: sockets *: ...


ls -I <filename> -I = Ignores the file. It won't list the specified file. To ignore more than one file add multiple -I before files. ls -I file1 -I file2


This is located in your .bashrc: alias ll='ls -al' By taking a look at the manual pages for the command ls, you can see what those two attributes accomplish together: -a: do not ignore entries starting with .. -l: use a long listing format. So you can understand that ls -l would ignore any entry starting with .. That's their only difference. EDIT: ...


ls -alR That's probably the simplest method. I'm just hacking out a find script to give you a touch more control.


karthick@Ubuntu-desktop:~$ ls -n drwxr-xr-x 2 1000 1000 4096 2010-12-02 15:56 Books First Column: drwxr-xr-x It shows file permission. Second Column: 2 It shows the hard link count to that file/directory. Third nd Fourth Column: 1000 1000 It shows UID and GID of the user. Fifth column: 4096 It shows the size. Sixth column: ...


// is usually the same as /. /// must be the same as /. ls would have shown you that cd // took you to the root directory, the same as cd / does. $ cd / $ ls bin boot dev ... $ cd // $ ls (same as above) The technical way to confirm they are definitely the same directory is: $ cd / $ stat -c "%i" . 2 $ cd // $ stat -c "%i" . 2 they will print the ...


In addition to @muru 's answer, here is the part of the source code which calculates width for right justification of output. : static void format_user_or_group (char const *name, unsigned long int id, int width) { size_t len; if (name) { int width_gap = width - mbswidth (name, 0); int pad = MAX (0, width_gap); fputs (name, ...


I believe you're talking about indicators presented by ls -F. From the manpage of ls: -F, --classify append indicator (one of */=>@|) to entries [...] --indicator-style=WORD append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) To get an overview of the meaning of these indicators,...


ls -d .!(|.) Does exactly what OP is looking for .


Based on your screenshot, it appears that the files are indeed being displayed. It's just that they happen to have the same color as the background so you are not seeing them. Some solutions: 1) (recommended) Change the color scheme: Make sure nothing shares the same color as the background by opening a terminal and go to Edit > Profile Preferences > ...


Generally, you can prepend \ to a command to disable aliasing only for that instance of the command run. E.g., [2023]$ alias ls alias ls='ls -F -Chs --color=tty' [2024]$ ls total 140K 4.0K bin/ 0 Downloads@ 0 prog.git@ ... [2025]$ \ls bin Downloads doc.git freertos.git prog.git tmp ... So, I recommend trying your ls with a ...


Because, as you say, the input of file has to be filenames. The output of ls, however, is just text. That it happens to be a list of file names, doesn't change the fact that it is simply text and not the location of files on the hard drive. When you see output printed on the screen, what you see is text. Whether that text is a poem or a list of filenames ...


Find-based solution: find . -maxdepth 1 -type f -printf '%f\n' Bash-based solution: for f in *; do [[ -d "$f" ]] || echo "$f"; done ## or, if you want coloured output: for f in *; do [[ -d "$f" ]] || ls -- "$f"; done The bash-based solution will get you everything that isn't a directory; it will include things like named pipes (you probably want this)....


It appears that you are in the directory /root and not /. Please type: cd / ls -al

Only top voted, non community-wiki answers of a minimum length are eligible