Visit Our UNIX and Linux User Community


making commands by sorting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers making commands by sorting
# 1  
Old 10-01-2009
making commands by sorting

how to write a command line that displays a long listing of the contents of the working directory, sorted by the date the file or directory was last modified, one screen at a time.
# 2  
Old 10-01-2009
Using more to display a screen at a time or use pg instead.
Descending
Code:
ls -lt * | more

Ascending
Code:
ls -ltr * | more

# 3  
Old 10-01-2009
Quote:
Originally Posted by jorogon0099
how to write a command line that displays a long listing of the contents of the working directory, sorted by the date the file or directory was last modified, one screen at a time.
1. long listing

Code:
ls -l

2. sorted by date of last modification
Code:
ls -t

3. one screen at a time ( if 25 lines )
Code:
head -n 25

finally, you can achieve by the following.
Code:
ls -lt | head -n 25

 

Previous Thread | Next Thread
Test Your Knowledge in Computers #494
Difficulty: Easy
A block of code is a section of code that has been logically grouped together.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help me making this script

This script is executed whenever a new vehicle is added to the cycle-motor park of campus. The script asks for the following information about the car and adds a new line to the vehicle file.txt: name (name of an animal, unique identifier), color, mark, model, type (e.g., electrical, manual),... (2 Replies)
Discussion started by: andre2222
2 Replies

2. UNIX for Advanced & Expert Users

Regarding help for making own OS

Dear Fellow, I want to make my own OS, Kindly suggest from where i should start. please help me out. (2 Replies)
Discussion started by: zaigham_tt
2 Replies

3. AIX

HACMP: difference between 'cl' commands and 'cli' commands

Hi all, I'm new in this forum. I'm looking for the difference between the HACMP commands with the prefix "cl" and "cli". The first type are under /usr/es/sbin/cluster/sbin directory and the second are under /usr/es/sbin/cluster/cspoc directory. I know that the first are called HACMP for AIX... (0 Replies)
Discussion started by: peppix
0 Replies

4. Shell Programming and Scripting

Making Variables

Dear Friends, Here I need your help once again. I have a flat file with pipe de-limited format e.g. 12345|1234567890|0|0|0| (Total 5 values) I want to take all non 0 ("Zero") values in variables named as anu1, anu2, anu3, anu4 and anu5. Is it possible? Please guide me. Thank you in... (3 Replies)
Discussion started by: anushree.a
3 Replies

5. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

6. Shell Programming and Scripting

help making loops

I feel like what I need to do, would be best accomplished with a loop. However I dont have the slightest idea how to set that up. The script is part of a interactive shell, for making settings to a Mac OS X server. This particular part is in regards to disabling files services. ... (3 Replies)
Discussion started by: afriend
3 Replies

7. Programming

code that reads commands from the standard i/p and executes the commands

Hello all, i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e... (4 Replies)
Discussion started by: Phrozen Smoke
4 Replies

8. Shell Programming and Scripting

Need help making a script

Here is what I have: #!/bin/bash # Setup year date and month YR=`date +%Y '{print $6}'` MON=`date +%b '{print $2}'` DAY=`date +%d '{print $3}'` file=$YR$MOY$DOM # clear # Dump database using USER/PASS to ..sql mysqldump --user=me -ppass database > database-db.$file.sql The YR, MON and... (2 Replies)
Discussion started by: npereira
2 Replies

9. UNIX for Dummies Questions & Answers

Making the right choise

I need help on making right decision on witch unix based OS to choose from. What woud be the great for a beginner? :confused: (8 Replies)
Discussion started by: thunderfastfox
8 Replies

Featured Tech Videos