Having following list of files:
-rw-r----- 1 mysql install 80550 Dec 11 16:40 TEST30042.log
-rw-r----- 1 mysql install 74006 Dec 11 17:39 TEST30032.log
-rw-r----- 1 mysql install 74566 Dec 11 17:39 TEST30012.log
-rw-r----- 1 mysql install 88435 Dec 11 17:39 TEST32.log
-rw-r----- 1 mysql install 79540 Dec 11 17:39 TEST30022.log
-rw-r----- 1 mysql install 17276 Dec 11 21:07 TEST30021.log
-rw-r----- 1 mysql install 15623 Dec 11 21:07 TEST31.log
-rw-r----- 1 mysql install 17280 Dec 11 21:07 TEST30031.log
-rw-r----- 1 mysql install 16302 Dec 11 21:07 TEST30011.log
-rw-r----- 1 mysql install 16002 Dec 11 21:07 TEST30041.log
-rw-r----- 1 mysql install 29035 Dec 12 14:00 TEST30010.log
-rw-r----- 1 mysql install 16926 Dec 12 14:00 TEST30020.log
-rw-r----- 1 mysql install 14381 Dec 12 14:00 TEST30040.log
-rw-r----- 1 mysql install 29157 Dec 12 14:00 TEST30030.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST30.log
-rw-r----- 1 mysql install 5977 Dec 12 15:02 TEST3002.log
-rw-r----- 1 mysql install 6670 Dec 12 15:03 TEST3001.log
-rw-r----- 1 mysql install 6670 Dec 12 15:03 TEST3003.log
-rw-r----- 1 mysql install 6526 Dec 12 15:03 TEST3004.log
-rw-r----- 1 mysql install 7167 Dec 12 19:29 TEST3.log
Trying to list only the files with the name TEST3.log, TEST30.log, TEST31.log, TEST32.log using following command. But the not getting desired output.
$ ls -ltr TEST3?.log
-rw-r----- 1 mysql install 88435 Dec 11 17:39 TEST32.log
-rw-r----- 1 mysql install 15623 Dec 11 21:07 TEST31.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST30.log
To my understanding, "?" is notation for zero or single occurrence. Couldn't figure out why TEST3.log file is being left out..
Expected Output
-rw-r----- 1 mysql install 88435 Dec 11 17:39 TEST32.log
-rw-r----- 1 mysql install 15623 Dec 11 21:07 TEST31.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST30.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST3.log
Figured one way to do this is by doing
ls -ltr TEST3?.log TEST3.log
-rw-r----- 1 mysql install 88435 Dec 11 17:39 TEST32.log
-rw-r----- 1 mysql install 15623 Dec 11 21:07 TEST31.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST30.log
-rw-r----- 1 mysql install 21761 Dec 12 14:00 TEST3.log
Wondering if there is a better simplest way to do it.
Thanks in advance.
The ? operator represents exactly one wildcard character. There is no operator for zero or one characters. You would have to use a loop or pipe ls through another tool.
I assume you are using Linux based on the directory listing.
Related
I'm working on a project that installs the dependencies using brew.
We need pybind11 to build our python module.
When I ll the available files I get:
#DOCKER:include ^_^$ ll pybind11/
total 548K
-rw-rw-r-- 1 builder docker 24K Nov 8 10:32 attr.h
-rw-rw-r-- 1 builder docker 7.0K Nov 8 10:32 buffer_info.h
-rw-rw-r-- 1 builder docker 64K Nov 8 10:32 cast.h
-rw-rw-r-- 1 builder docker 8.7K Nov 8 10:32 chrono.h
-rw-rw-r-- 1 builder docker 120 Nov 8 10:32 common.h
-rw-rw-r-- 1 builder docker 2.1K Nov 8 10:32 complex.h
drwxrwxr-x 2 builder docker 4.0K Nov 8 10:32 detail
-rw-rw-r-- 1 builder docker 31K Nov 8 10:32 eigen.h
-rw-rw-r-- 1 builder docker 12K Nov 8 10:32 embed.h
-rw-rw-r-- 1 builder docker 5.5K Nov 8 10:32 eval.h
-rw-rw-r-- 1 builder docker 4.7K Nov 8 10:32 functional.h
-rw-rw-r-- 1 builder docker 6.7K Nov 8 10:32 gil.h
-rw-rw-r-- 1 builder docker 8.7K Nov 8 10:32 iostream.h
-rw-rw-r-- 1 builder docker 77K Nov 8 10:32 numpy.h
-rw-rw-r-- 1 builder docker 9.6K Nov 8 10:32 operators.h
-rw-rw-r-- 1 builder docker 2.2K Nov 8 10:32 options.h
-rw-rw-r-- 1 builder docker 123K Nov 8 10:32 pybind11.h
-rw-rw-r-- 1 builder docker 80K Nov 8 10:32 pytypes.h
drwxrwxr-x 2 builder docker 4.0K Nov 8 10:32 stl
-rw-rw-r-- 1 builder docker 27K Nov 8 10:32 stl_bind.h
-rw-rw-r-- 1 builder docker 15K Nov 8 10:32 stl.h
Is this enough?
When I try to add pybind11 to my CMakeLists.txt:
include_directories("/cache/venv/include/pybind11")
#I tried this too: add_subdirectory("/cache/venv/include/pybind11" ".")
pybind11_add_module(pystuff binding.cpp)
I always get the same error:
CMake Error at src/applications/pycore/CMakeLists.txt:60 (pybind11_add_module):
Unknown CMake command "pybind11_add_module".
What am I missing?
I tried installing pybind11 using pip but cmake still can't find the command.
(I'm using a docker image based on ubuntu 22)
I have a very simple code to test this:
#include <pybind11/pybind11.h>
namespace py = pybind11;
int return42(){ return 42;}
PYBIND11_MODULE(pystuff, m) {
m.def("return42", &return42, "A function that returns 42");
}
If I don't add the pybind11_add_module(pystuff binding.cpp) line on cmake, the project compiles, however I guess pybind11 needs to add the module to actually work
You need to use:
find_package(pybind11 REQUIRED)
If it doesn't find it right away, then pip install pybind11[global] to make the CMake bindings available from the venv root. Then include /cache/venv in CMAKE_PREFIX_PATH.
If you determine the directory containing the files pybind11*.cmake then you can set pybind11_DIR to the directory containing those files without installing pybind11[global].
In no case should you set() the variables I mentioned inside the CMakeLists.txt file. Prefer to use environment variables in Docker or the PATHS argument to find_package.
I am trying to deploy my Django project on a Bitnami server, but when I try to login through admin with my superuser i get the following error:
attempt to write a readonly database
Exception Location: /opt/bitnami/python/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py, line 413, in execute
I have the following permissions to my project files:
drwxrwxr-x 6 bitnami www-data 4096 Mar 12 08:01 .
drwxr-xr-x 3 bitnami root 4096 Mar 11 10:00 ..
drwxr-xr-x 2 bitnami bitnami 4096 Mar 11 11:48 conf
-rw-rw-r-- 1 bitnami www-data 147456 Mar 12 08:01 db.sqlite3
-rw-r--r-- 1 bitnami bitnami 287 Mar 11 13:29 .env
drwxr-xr-x 5 bitnami bitnami 4096 Mar 11 10:26 app
-rwxr-xr-x 1 bitnami bitnami 667 Mar 11 10:00 manage.py
drwxr-xr-x 3 bitnami bitnami 4096 Mar 11 13:52 django_project
drwxr-xr-x 5 bitnami bitnami 4096 Mar 11 10:26 users
and this to the project directory
drwxrwxr-x 6 bitnami www-data 4096 Mar 12 08:01 django_project
I tried to run the following to give permission but without luck:
sudo chown :www-data /opt/bitnami/projects/django_project/db.sqlite3
sudo chmod 664 /opt/bitnami/projects/django_project/db.sqlite3
sudo chown :www-data /opt/bitnami/projects/django_project/
sudo chmod 775 /opt/bitnami/projects/django_project/
Can you help me? :)
Bitnami developer here. You are setting the group to www-data. The Bitnami Apache user is "daemon".
I'm doing a installation on a Ubuntu machine (16.04 server) and I need to install the plugins for the Redmine platform (the lastest version). I installed Redmine using the official documentation: Install Redmine step by step on Ubuntu
The installation was successful but now I have to install some plugins but every time I try to install I get: plugin was not found.
Since I made everything as said in the documentation I have this folder structure:
var/www/html/redmine
-rw-r--r-- 1 root root 459 Mar 13 2016 404.html
-rw-r--r-- 1 root root 648 Mar 13 2016 500.html
-rwxr-xr-x 1 root root 473 Mar 13 2016 dispatch.fcgi
-rw-r--r-- 1 root root 7886 Mar 13 2016 favicon.ico
-rw-r--r-- 1 root root 43 Jul 13 12:07 Gemfile
-rw-r--r-- 1 root root 143 Jul 13 12:07 Gemfile.lock
drwxr-xr-x 51 root root 4096 Jul 12 16:11 help
drwxr-xr-x 4 root root 4096 Jul 12 16:12 images
drwxr-xr-x 4 root root 4096 Jul 12 16:12 javascripts
drwxr-xr-x 2 root root 4096 Jul 12 16:12 plugin_assets
drwxrwxrwx 4 root root 4096 Jul 19 17:30 plugins
lrwxrwxrwx 1 root root 25 Jul 19 18:37 public -> /usr/share/redmine/public
drwxr-xr-x 9 root root 4096 Jul 13 10:02 redmine_agile
drwxr-xr-x 3 root root 4096 Jul 12 16:12 stylesheets
drwxr-xr-x 5 root root 4096 Jul 12 18:05 themes
To install the plugins I follow this tutorial: Install plugin. I use this command: bundle install --without development test --no-deployment on /var/www/html and everything is ok. But then I need to use bundle exec rake redmine:plugins NAME=redmine_checklists RAILS_ENV=production (in the same location as the previous command) and I get plugin was not found
Things I already tried:
Use Redmine last version
update bundler
execute rake on Redmine root
update all gems
set the right permissions on the plugins folders
and nothing seems to work.
bundle exec rake redmine:plugins:migrate RAILS_ENV=production NAME="YOUR_PLUGIN_NAME" in the root_app folder
Running the django tutorial for docker compose, but the command to init the django project is not working as expected.
$ docker-compose run web django-admin.py startproject composeexample .
[31mERROR[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
In windows "interactive" mode is not supported so I modified the command to run in "detached" mode.
$ docker-compose run -d web django-admin.py startproject composeexample .
Creating network "djangotest_default" with the default driver
...
Successfully built 0fb90648c1d8
[33mWARNING[0m: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
djangotest_web_run_1
This seems to create the boxes.. but my current directory shows no new files (from the django-admin command).
$ ls
docker-compose.yml Dockerfile requirements.txt
How do I get the container output to sync with the current working directory as expected?
The fix was to uninstall Windows 10 and install a *nix system. The files then appear as per the tutorial.
~/docker/django-test $ ll
total 60
drwxr-xr-x 4096 Sep 24 00:47 ./
drwxr-xr-x 4096 Sep 24 00:40 ../
drwxr-xr-x 4096 Sep 24 00:47 composeexample/
-rw-r--r-- 209 Sep 24 00:41 docker-compose.yml
-rw-r--r-- 146 Sep 24 00:41 Dockerfile
-rwxr-xr-x 812 Sep 24 00:47 manage.py*
-rw-r--r-- 16 Sep 24 00:41 requirements.txt
I have three directories(farmio,farmio-table,farmio-table-throttle) in apps directory of AWS-Centos server under username ec2-user, every time I do a ls -la I see two folders(farmio-table,farmio-table-throttle) accessed frequently and the pid file stored inside the folder are wiped out for which my java programs doesn't execute properly.
[ec2-user#ip-10-94-221-19 apps]$ ls -la
total 49036
drwxrwxr-x 5 ec2-user root 4096 Nov 7 09:39 .
drwxrwxr-x 3 ec2-user root 4096 May 29 12:20 ..
-rw-rw-r-- 1 ec2-user ec2-user 29 Nov 6 06:26 date.txt
drwxrwxr-x 4 ec2-user ec2-user 4096 Nov 6 06:42 farmio
drwxrwxrwx 7 ec2-user ec2-user 4096 Nov 7 2015 farmio-table
-rw-r----- 1 ec2-user ec2-user 25090806 Nov 7 09:43 farmio-table-bin.zip
drwxrwxrwx 7 ec2-user ec2-user 4096 Nov 7 2015 farmio-table-throttle
-rw-r----- 1 ec2-user ec2-user 25092514 Nov 7 09:39 farmio-table-throttle-bin.zip
Every time I try to check the folders are changed or replaced after five minutes.
Is there any way I could know which user and which command is executed in this directory so that its files are replaced/modified in Centos.
Use command history to check all the previously run commands.
$ history